Last active
June 17, 2017 08:40
-
-
Save ShawInnes/c875562a6cec87fe760a7f5032b899ed to your computer and use it in GitHub Desktop.
Install openCV3 with Python3 on OSX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| ## need to make sure current python version is 3.6.1 also | |
| pip install numpy | |
| cmake -D CMAKE_BUILD_TYPE=RELEASE \ | |
| -D CMAKE_INSTALL_PREFIX=/usr/local \ | |
| -D OPENCV_EXTRA_MODULES_PATH=~/devops/opencv_contrib/modules \ | |
| -D PYTHON3_LIBRARY=/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin/libpython3.6.dylib \ | |
| -D PYTHON3_INCLUDE_DIR=/Users/shaw.innes/.virtualenvs/opencv/include/python3.6m \ | |
| -D PYTHON3_EXECUTABLE=$VIRTUAL_ENV/bin/python \ | |
| -D BUILD_opencv_python2=OFF \ | |
| -D BUILD_opencv_python3=ON \ | |
| -D INSTALL_PYTHON_EXAMPLES=ON \ | |
| -D INSTALL_C_EXAMPLES=OFF \ | |
| -D WITH_OPENCL=ON \ | |
| -D BUILD_EXAMPLES=ON .. | |
| make -j4 | |
| sudo make install | |
| mv /usr/local/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so /usr/local/lib/python3.6/site-packages/cv2.so | |
| PYTHON_SITE_PACKAGES=`python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"` | |
| ln -s /usr/local/lib/python3.6/site-packages/cv2.so "$PYTHON_SITE_PACKAGES/cv2.so" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment