Failed to import cv2 into python2.7 on OSX El Capitan (opencv3.1.0)

I used this tutorial to install opencv on my mac (no virtual environment). However, when I run python and want to import cv2, I get the following error:

>>> import cv2
Traceback (most recent call last):
File "", line 1, in
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/cv2.so, 2): Library not loaded: lib/libopencv_reg.3.1.dylib
Referenced from: /usr/local/lib/python2.7/site-packages/cv2.so
Reason: image not found

I tried the solution mentioned in here , but that didn't work. Any help would be greatly appreciated.

+4
source share
1 answer

This was fixed for me by specifying the path to the opencv library:

export DYLD_LIBRARY_PATH=/full/path/to/opencv/build/lib:$DYLD_LIBRARY_PATH

0
source

Source: https://habr.com/ru/post/1623189/


All Articles