小白一只,安装过程如下
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install
import cv,就出现这个
import cv
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/cv.py", line 1, in <module>
from cv2.cv import *
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/cv2.so, 2): Library not loaded: libopencv_contrib.2.4.dylib
Referenced from: /usr/local/lib/python2.7/site-packages/cv2.so
Reason: unsafe use of relative rpath libopencv_contrib.2.4.dylib in /usr/local/lib/python2.7/site-packages/cv2.so with restricted binary
Is your system Mac 10.11?
The system’s security mechanism does not allow the use of insecure relative connections
Solution
1. Turn off this mechanism
Restart your Mac, hold down the Command+R keys until the Apple logo appears, enter Recovery Mode
Click Utilities > Terminal
dEnter csrutil disable in Terminal and press Enter
Restart Mac
2. Replace relative paths with absolute paths
GitHub - zsirui/opencv-fix-path-on-OSX: Fix path error when installed OpenCV 3.1.0 through CMake build on OSX Path error