I am using Anaconda on OS X Mavericks. When I try loading cv2
I get an import error (see below). Do you know how to fix this?
>>import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/usr/local/Cellar/opencv/2.4.8.2/lib/python2.7/site-packages/cv2.so,
2): Library not loaded: /usr/local/lib/libpng15.15.dylib
Referenced from: /usr/local/Cellar/opencv/2.4.8.2/lib/libopencv_highgui.2.4.dylib
Reason: image not found
I am not sure it's relevant, but in /usr/local/lib/
I have libpng16.16.dylib
instead of libpng15.15.dylib
.
The Python "ModuleNotFoundError: No module named 'cv2'" occurs when we forget to install the opencv-python module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install opencv-python command.
importerror no module named cv2 error occurs when cv2 module is not properly installed or its path is not properly set or configured. The straight way fix for this error (no module named cv2) is to reinstall this module (OpenCV-python). In some scenario reinstalling this module automatically remove the older version.
One of possibility is that you could have written import cv2 and its utilisation in separate cells of jupyter notebook. If this is the case then first run the cell having import cv2 part and then run the cell utilising the cv2 library.
This is the solution I found:
PYTHONPATH
environment in ~/.bash_profile, as suggested by @asmeurerAs suggested in this issue, I fixed this problem by simply executing
conda update hdf5
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With