Last active
December 23, 2020 07:30
-
-
Save fengyuentau/77b813f369ce1d521d5b6608d702d33e to your computer and use it in GitHub Desktop.
CMake command to compile OpenCV(>=4.0) with conda python interface
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
# Following is an example compiling OpenCV with conda python in MacOS. | |
# To compile opencv with python2, change options related to python3 accordingly. | |
# Option PYTHON3_LIBRARY is the location to libpythonx.x.dylib or libpythonx.x.so. | |
# Option PYTHON3_INCLUDE_DIR is the location to a directory with `Python.h` etc. Run `python -c 'import distutils.sysconfig as s; print(s.get_python_inc())'` to get the path. | |
# Option PYTHON3_EXECUTABLE is the location to pythonx.x executable. Run `which python` to get the directory. | |
cmake -D CMAKE_BUILD_TYPE=RELEASE \ | |
-D CMAKE_INSTALL_PREFIX=/Users/fengyuentau/Documents/opencv \ | |
-D PYTHON3_LIBRARY=/usr/local/Caskroom/miniconda/base/lib \ | |
-D PYTHON3_INCLUDE_DIR=/usr/local/Caskroom/miniconda/base/include/python3.8 \ | |
-D PYTHON3_EXECUTABLE=/usr/local/Caskroom/miniconda/base/bin/python \ | |
-D BUILD_opencv_python2=OFF \ | |
-D BUILD_opencv_python3=ON \ | |
-D INSTALL_PYTHON_EXAMPLES=OFF \ | |
-D INSTALL_C_EXAMPLES=OFF \ | |
-D OPENCV_ENABLE_NONFREE=OFF \ | |
-D BUILD_EXAMPLES=OFF \ | |
-D OPENCV_GENERATE_PKGCONFIG=YES .. # https://github.com/opencv/opencv/issues/13154#issuecomment-456652297 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment