在python上使用cv2导入错误

时间:2018-11-14 17:15:04

标签: python opencv python-import

我无法在python2或python3上导入cv2

当我在python2中调用时,出现以下错误

ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: numpy.core.multiarray failed to import

当我调用python3

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /usr/local/lib/python3.5/dist-packages/cv2.so: undefined 
symbol: PyCObject_Type

我知道它与路径有关,当我使用>>> print(sys.path)时,我得到以下信息

['', '/home/nvidia/Downloads', '/usr/local/lib', 
'/usr/local/lib/python3.5/dist-packages', '/usr/local/lib/cv2.po', 
'//home/nvidia/src/opencv-3.4.2/build/lib/cv2.so', 
'/home/nvidia/src/opencv-3.4.2/build/lib/cv2.so', 
'/usr/local/lib/python3.5/dist-packages/cv2.so', 
'/usr/lib/python35.zip', '/usr/lib/python3.5', 
'/usr/lib/python3.5/plat-aarch64-linux-gnu', '/usr/lib/python3.5/lib- 
dynload', '/usr/lib/python3/dist-packages']

我敢肯定,我必须删除一些上述路径,但是我不确定自己是否愿意冒险。作为记录,我正在使用Jetson TX2

编辑:尝试通过更新numpy来解决问题,但错误仍然存​​在

编辑#2:这些是我当前已安装的numpy版本

python -c "import numpy; print(numpy.version.version)" 1.15.4


python3 -c "import numpy; print(numpy.version.version)" 1.15.4

0 个答案:

没有答案