Jython无法找到该模块

时间:2015-07-22 19:11:16

标签: java python jython-2.7

这些是导入声明:

PythonInterpreter interpreter = new PythonInterpreter();
PySystemState sys = interpreter.getSystemState(); 
sys.path.append(new PyString("/usr/lib/pymodules/python2.7")); interpreter.exec("from nltk import wordpunct_tokenize"); interpreter.exec("from nltk.corpus import stopwords"); interpreter.exec("import nltk"); 
interpreter.exec("import svm"); interpreter.exec("from svmutil import *");
interpreter.exec("from nltk.classify import *");

S.o.p(sys.path)的输出:

['/home/deepak/.m2/repository/org/python/jython-standalone/2.7.0/Lib', '/home/deepak/.m2/repository/org/python/jython-standalone/2.7.0/jython-standalone-2.7.0.jar/Lib', '__classpath__', '__pyclasspath__/', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/pymodules/python2.7']

dir = "/usr/local/lib/python2.7/dist-packages包含nltk模块,工作正常。

dir= "/usr/lib/pymodules/python2.7"包含svm模块。

这是输出错误:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/pymodules/python2.7/svmutil.py", line 3, in <module>
    from svm import *
  File "/usr/lib/pymodules/python2.7/svm.py", line 4, in <module>
    from ctypes.util import find_library
ImportError: No module named util

我需要做些什么才能让Jython找到模块?

0 个答案:

没有答案