Skip to content

Instantly share code, notes, and snippets.

@twmht
Created December 12, 2019 08:29
Show Gist options
  • Save twmht/2bebefc225120115bc26e3714dfe7eed to your computer and use it in GitHub Desktop.
Save twmht/2bebefc225120115bc26e3714dfe7eed to your computer and use it in GitHub Desktop.
build python3 of opencv
PYTHON3_ROOT=/home/acer/.pyenv/versions/3.7.4
# cmake -D CMAKE_BUILD_TYPE=RELEASE \
# -D BUILD_NEW_PYTHON_SUPPORT=ON \
# -D BUILD_opencv_python3=ON \
# -D HAVE_opencv_python3=ON \
# -D CMAKE_INSTALL_PREFIX=/home/acer/opencv_build \
# -D PYTHON3_EXECUTABLE=/home/acer/.pyenv/versions/3.7.4/bin/python \
# -D PYTHON_DEFAULT_EXECUTABLE=${PYTHON3_ROOT}/bin/python \
# -D PYTHON3_INCLUDE_DIR=${PYTHON3_ROOT}/include/python3.7m \
# -D PYTHON3_LIBRARIES=${PYTHON3_ROOT}/lib/libpython3.7m.so \
# -D PYTHON3_NUMPY_INCLUDE_DIRS=$(python -c "import numpy; print(numpy.get_include())") \
# -D PYTHON3_PACKAGES_PATH=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
# ..
#FIXME: pyenv won't work
cmake -D BUILD_NEW_PYTHON_SUPPORT=ON \
-D BUILD_opencv_python3=ON \
-D HAVE_opencv_python3=ON \
-D PYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3 \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/home/acer/opencv_build \
..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment