1

我正在开发一个快速界面,以允许在来自 java 的 rpi sense hat 中使用 9 DOF IMU,但我似乎无法让 python 工作。我已将 python 2.7 库添加到 Jython 环境的 sys 路径中,但它仍然找不到这个“type_check”模块。

这是java代码:

PythonInterpreter interpreter;

SenseHat()
{
    interpreter = new PythonInterpreter();
    interpreter.exec("import sys");
    interpreter.exec("sys.path.append('/usr/lib/python2.7/dist-packages')");
    interpreter.exec("from sense_hat import SenseHat");
    interpreter.exec("sense = SenseHat()");
    PyObject result = interpreter.eval("sense.get_temperature()");
    System.out.println(result.toString());
    interpreter.close();
}

它尝试使用 RPI sense hat python API。执行时出现此错误:

Exception in thread "main" Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/sense_hat/__init__.py", line 2, in <module>
    from .sense_hat import SenseHat, SenseHat as AstroPi
  File "/usr/lib/python2.7/dist-packages/sense_hat/sense_hat.py", line 7, in <module>
    import numpy as np
  File "/usr/lib/python2.7/dist-packages/numpy/__init__.py", line 153, in <module>
    from . import add_newdocs
  File "/usr/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
ImportError: No module named type_check
4

0 回答 0