opencv: 'import cv2' fails because numpy.core.multiarray fails to import
$ cat x.py
import cv2
[yuri@yv ~/]$ python2 x.py
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
File "x.py", line 3, in <module>
import cv2
ImportError: numpy.core.multiarray failed to import
Adding import numpy.core.multiarray
before import cv2
fixes the problem.
py27-opencv2-2.4.13.1_1 on FreeBSD.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 6
- Comments: 23 (4 by maintainers)
I don’t do Python.
I don’t really understand this error but I solved this error with below. “pip install -U opencv-python”
For me, the combination of
opencv_python==4.0.0.21
andnumpy==1.14.5
works.Did anybody find a solution for this?
For me only opencv_python==4.4.0.46 and numpy==1.19.3 works.
I installed numpy again using sudo and -U option. I applied $sudo pip3 install -U numpy Then it just worked.