Create a gist now

Instantly share code, notes, and snippets.

@pohmelie /readme.md
Last active Jul 17, 2017

What would you like to do?
Install opencv3 for python 3.5.0 with pyenv on ubuntu 14.04

Install opencv3 for python 3.5.0 with pyenv on ubuntu 14.04

  • update cmake and install deps as this said.

  • run cmake

    cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=~/.pyenv/versions/3.5.0/usr/local/ \
    -D INSTALL_C_EXAMPLES=OFF \
    -D BUILD_NEW_PYTHON_SUPPORT=ON \
    -D BUILD_opencv_python3=ON \
    -D BUILD_opencv_legacy=OFF \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D OPENCV_EXTRA_MODULES_PATH=~/tmp/opencv_contrib/modules \
    -D BUILD_EXAMPLES=ON \
    -D PYTHON_EXECUTABLE=~/.pyenv/versions/3.5.0/bin/python \
    -D PYTHON_LIBRARY=~/.pyenv/versions/3.5.0/lib/libpython3.5m.a \
    -D PYTHON_INCLUDE_DIR=~/.pyenv/versions/3.5.0/include/python3.5m \
    -D PYTHON_INCLUDE_DIRS=~/.pyenv/versions/3.5.0/include/python3.5m \
    -D PYTHON_INCLUDE_DIRS2=~/.pyenv/versions/3.5.0/include/python3.5m \
    -D INCLUDE_DIRS=~/.pyenv/versions/3.5.0/include/python3.5m \
    -D INCLUDE_DIRS2=~/.pyenv/versions/3.5.0/include/python3.5m \
    -D PYTHON_PACKAGES_PATH=~/.pyenv/versions/3.5.0/lib/python3.5/site-packages \
    -D PYTHON_NUMPY_INCLUDE_DIR=~/.pyenv/versions/3.5.0/lib/python3.5/site-packages/numpy/core/include ..
    

    Don't forget to change OPENCV_EXTRA_MODULES_PATH

  • make

  • make install

  • [~/.pyenv/versions/3.5.0/lib/python3.5/site-packages]$ ln -s ~/.pyenv/versions/3.5.0/usr/local/lib/python3.5/site-packages/cv2.cpython-35m-x86_64-linux-gnu.so cv2.so

  • 🎉

Links:

  1. https://gist.github.com/rjw57/d50dd8a023afa84a5bdb
  2. http://www.pyimagesearch.com/2015/07/20/install-opencv-3-0-and-python-3-4-on-ubuntu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment