4

我面临使用来自 java 的 PythonInterpreter 导入 .so 文件的问题

从蟒蛇:

$ 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,效果很好。

如何解决这个问题?

4

0 回答 0