Python 2.7 在Jython 2.7.0上安装networkx 1.9.1
从官方networkx: Jython 2.7[…]增加了基本支持,尽管它们仍然没有得到官方支持 如何在Jython上安装networkx 我尝试过的:Python 2.7 在Jython 2.7.0上安装networkx 1.9.1,python-2.7,pip,jython,networkx,jython-2.7,Python 2.7,Pip,Jython,Networkx,Jython 2.7,从官方networkx: Jython 2.7[…]增加了基本支持,尽管它们仍然没有得到官方支持 如何在Jython上安装networkx 我尝试过的: 在我的Ubuntu 14.04 32位上安装了jython2.7.0 已尝试通过pip安装networkx: sudo/opt/jython2.7.0/bin/pip安装networkx 下载了networkx-1.9.1-py2.py3文件无任何.whl,但在某个点出错: Exception: Traceback (most recent
- 在我的Ubuntu 14.04 32位上安装了jython2.7.0
- 已尝试通过pip安装networkx:
sudo/opt/jython2.7.0/bin/pip安装networkx
下载了networkx-1.9.1-py2.py3文件无任何.whl,但在某个点出错:
Exception:
Traceback (most recent call last):
File "/opt/jython2.7.0/Lib/site-packages/pip/basecommand.py", line 133, in main
status = self.run(options, args)
File "/opt/jython2.7.0/Lib/site-packages/pip/commands/install.py", line 325, in run
requirement_set.install(
File "/opt/jython2.7.0/Lib/site-packages/pip/commands/install.py", line 325, in run
requirement_set.install(
File "/opt/jython2.7.0/Lib/site-packages/pip/req/req_set.py", line 633, in install
requirement.install(
File "/opt/jython2.7.0/Lib/site-packages/pip/req/req_install.py", line 719, in install
self.move_wheel_files(self.source_dir, root=root)
File "/opt/jython2.7.0/Lib/site-packages/pip/req/req_install.py", line 990, in move_wheel_files
move_wheel_files(
File "/opt/jython2.7.0/Lib/site-packages/pip/wheel.py", line 154, in move_wheel_files
compileall.compile_dir(source, force=True, quiet=True)
File "/opt/jython2.7.0/Lib/compileall.py", line 56, in compile_dir
if not compile_dir(fullname, maxlevels - 1, dfile, force, rx,
File "/opt/jython2.7.0/Lib/compileall.py", line 56, in compile_dir
if not compile_dir(fullname, maxlevels - 1, dfile, force, rx,
File "/opt/jython2.7.0/Lib/compileall.py", line 50, in compile_dir
if not compile_file(fullname, ddir, force, rx, quiet):
File "/opt/jython2.7.0/Lib/compileall.py", line 99, in compile_file
ok = py_compile.compile(fullname, None, dfile, True)
File "/opt/jython2.7.0/Lib/compileall.py", line 99, in compile_file
ok = py_compile.compile(fullname, None, dfile, True)
File "/opt/jython2.7.0/Lib/py_compile.py", line 99, in compile
_py_compile.compile(file, cfile, dfile)
File "/opt/jython2.7.0/Lib/py_compile.py", line 99, in compile
_py_compile.compile(file, cfile, dfile)
RuntimeException: java.lang.RuntimeException: Method code too large!
我在\u py\u compile.compile(file,cfile,dfile)
函数之前添加了以下打印语句:
print "file: %s" % file
print "cfile: %s" % cfile
print "dfile: %s" % dfile
这给了我:
file: /tmp/pip_build_vagrant/networkx/networkx/generators/atlas.py
cfile: None
dfile: None
有人在Jython2.7.0上安装了networkx 1.9吗?以下是在Jython中安装networkx的方法:
networkx/generators/atlas.py
(这个文件太大,Jython无法解析。它在Jython中无论如何都不起作用,所以只需删除它)networkx/readwrite/gml.py
中,删除对lib2to3的所有提及(由于Jython中的当前错误,lib2to3不可用):
- 在第44-46行,注释掉从lib2to3导入的内容
- 在大约75行上,更改:
致:rtp_fix_unicode = RefactoringTool(['lib2to3.fixes.fix_unicode'], {'print_function': True})
- 在try-except语句的第145行附近,删除ParseError和TokenError
jython/pip install .
或者,如果jython没有pip:
jython setup.py install
它应该安装成功,您现在应该能够在Jython中导入networkx。导入成功。没有时间做更多的事情。谢谢你的努力。报告为bug@JanusTroelsen谢谢,也许有人提交了补丁。如前所述,jython没有得到官方支持。然而,下面答案中的信息应该有助于创建快速修复。
jython setup.py install