在jython中导入python包

时间:2015-03-25 22:07:50

标签: python jython

我无法在jython中导入python包(例如numpy):

$ jython

>>> import sys 
>>> sys.path
['', '/usr/local/bin/jython2.5.3/Lib', '__classpath__', '__pyclasspath__/', '/usr/local/bin/jython2.5.3/Lib/site-packages']
>>> import numpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named numpy

然后我尝试通过将python.path = /Users/alavin/Library/Python/2.7/lib/python/site-packages添加到Python注册表文件“/jython2.5.3/registry”来添加我的PYTHONPATH ...

$ jython

>>> import sys 
>>> sys.path
['', '/Users/alavin/Library/Python/2.7/lib/python/site-packages/unittest2-0.8.0-py2.7.egg', '/Users/alavin/Library/Python/2.7/lib/python/site-packages/argparse-1.3.0-py2.7.egg', '/Users/alavin/Library/Python/2.7/lib/python/site-packages/alembic-0.6.7-py2.7.egg', '/Users/alavin/Library/Python/2.7/lib/python/site-packages/SQLAlchemy-0.9.4-py2.7-macosx-10.9-intel.egg', '/Users/alavin/Library/Python/2.7/lib/python/site-packages/web.py-0.37-py2.7.egg', '/Users/alavin/Library/Python/2.7/lib/python/site-packages', '/usr/local/bin/jython2.5.3/Lib', '__classpath__', '__pyclasspath__/', '/usr/local/bin/jython2.5.3/Lib/site-packages']
>>> import numpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named numpy

我在mac osx 10.9上。提前感谢您的帮助!

0 个答案:

没有答案