在java中使用PythonInterpreter导入.so文件

时间:2013-09-24 12:45:43

标签: java jython javascript-engine jython-2.5

我正面临probs从java使用PythonInterpreter导入.so文件

来自python:

$ python

Python 2.7.3 (default, Apr 10 2013, 06:20:15)
[GCC 4.6.3] on linux2

Type "help", "copyright", "credits" or "license" for more information.

import cv2

print cv2.__file__

/usr/lib/pyshared/python2.7/cv2.so

exit

Use exit() or Ctrl-D (i.e. EOF) to exit

来自Java:

PythonInterpreter ie = new PythonInterpreter();

ie.exec("import cv2");

$ javac InterperterExample.java

$java InterperterExample
Exception in thread "main" Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named cv2

但是导入像numpy这样的其他模块非常合适。

如何解决这个问题?

0 个答案:

没有答案