Trying to get opencv for python working on Mac OSX - Mavericks but keep getting an image not found for libjpeg.8.dylib when doing import cv from python
(Recently updated from Mountain Lion)
This is what I did:
1.brew tap homebrew/science
2.brew install opencv
3.python
4.import cv
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv.py", line 1, in <module>
from cv2.cv import *
ImportError: dlopen(/usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv2.so, 2): Library not loaded: /usr/local/lib/libjpeg.8.dylib
Referenced from: /usr/local/Cellar/opencv/2.4.9/lib/libopencv_highgui.2.4.dylib
Reason: image not found
/usr/local/Cellar/jpeg/8d/lib/
which, apparently, is not where libopencv_highgui.2.4.dylib is looking.I'm a bit new to Mac OS and homebrew. Could anyone explain how to resolve this error and get opencv running? I have the python that comes preinstalled with Mac and them python installed by homebrew.
Thank you.
cv2 (old interface in old OpenCV versions was named as cv ) is the name that OpenCV developers chose when they created the binding generators. This is kept as the import name to be consistent with different kind of tutorials around the internet.
The nice thing with OpenCV is that it comes with a complete Python 3 library. The latest GeeXlab 0.29. 17.0 for Windows 64-bit comes with Python 3.8.
Just had a similar problem to this (in python import opencv
was working for me one day, then the next it threw the same error you are reporting) and this solution just worked for me:
Upgrade your homebrew opencv eg.:
brew upgrade opencv
(or in my case brew upgrade opencv3
)
Hope this helps
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