Import errors with cv2 on python

Viewed 543

I am unable to import cv2 on either python2 or python3

when I call in python2 I get the following error

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

and when I call in 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

I know it has something to do with the path and When I use the >>> print(sys.path) I get the following

['', '/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']

I'm certain I have to remove some of the above paths but I do no want to risk anything without being sure. For the record I am using the Jetson TX2

Edit: attempted to fix the problem by updating numpy but the error persisted

Edit#2: These are the versions of numpy that I currently have install

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


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