Created
January 25, 2019 18:49
-
-
Save niazangels/d46b4f27798948fa70aa771000c17ec5 to your computer and use it in GitHub Desktop.
Cmake OpenCV4 for pipenv using Anaconda python3
This file contains 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
cmake -D CMAKE_BUILD_TYPE=RELEASE \ | |
-D CMAKE_INSTALL_PREFIX=/usr/local \ | |
-D INSTALL_PYTHON_EXAMPLES=ON \ | |
-D INSTALL_C_EXAMPLES=OFF \ | |
-D OPENCV_ENABLE_NONFREE=ON \ | |
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ | |
-D PYTHON_EXECUTABLE=~/.local/share/virtualenvs/kaggle-3VckuriQ/bin/python \ | |
-D PYTHON_NUMPY_INCLUDE_DIR=~/.local/share/virtualenvs/kaggle-3VckuriQ/lib/python3.6/site-packages/numpy/core/include/ \ | |
-D BUILD_opencv_python3=yes -D PYTHON_LIBRARY=/home/niyas/anaconda3/lib/libpython3.6m.so -D BUILD_EXAMPLES=ON .. | |
# Also see https://stackoverflow.com/questions/42638342/cannot-install-opencv-3-1-0-with-python3-cmake-not-including-or-linking-python | |
#cmake {...} -D CMAKE_BUILD_TYPE=RELEASE \ | |
# -D CMAKE_INSTALL_PREFIX=/usr/local \ | |
# -D INSTALL_C_EXAMPLES=OFF \ | |
# -D INSTALL_PYTHON_EXAMPLES=ON \ | |
# -D BUILD_EXAMPLES=ON \ | |
# -D PYTHON3_EXECUTABLE=$(which python3) \ | |
# -D PYTHON_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \ | |
# -D PYTHON_INCLUDE_DIR2=$(python3 -c "from os.path import dirname; from distutils.sysconfig import get_config_h_filename; print(dirname(get_config_h_filename()))") \ | |
# -D PYTHON_LIBRARY=$(python3 -c "from distutils.sysconfig import get_config_var;from os.path import dirname,join ; print(join(dirname(get_config_var('LIBPC')),get_config_var('LDLIBRARY')))") \ | |
# -D PYTHON3_NUMPY_INCLUDE_DIRS=$(python3 -c "import numpy; print(numpy.get_include())") \ | |
# -D PYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment