This is the case for me so unfortunately, I haven't looked into how to resolve the issues with other Python versions. If you only care about that specific version, then there's nothing else to worry about. The above arguments may only "fix" the issue for one version of Python but not the other. If you've got different versions here, it might get confused. The CMakeLists file will try to detect various versions of Python to build for. D PYTHON_EXECUTABLE=$HOME/.pyenv/versions/3.5.2/bin/python3.5 D PYTHON_INCLUDE_DIRS=$HOME/.pyenv/versions/3.5.2/include/python3.5m I use pyenv: -D PYTHON_DEFAULT_EXECUTABLE=$HOME/.pyenv/versions/3.5.2/bin/python3.5 You can change this by adding these arguments to the cmake command seen later in the script. By default OpenCV will build for the system's version of Python. from using pyenv or virtualenv), then you may want to build against a certain Python version. If you have multiple versions of Python (eg. # Builds in Eigen, a linear algebra library They should be included in the cmake command: # Builds in TBB, a threading library There might be comprehensive documentation about them, but here are some interesting flags that may be of use. There are several flags and options to tweak your build of OpenCV. Sudo apt install libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev # Optional, but installing these will ensure you have the latest versions compiled with OpenCV
Sudo apt install python3.5-dev libpython3-dev python3-numpy with pyenv or virtualenv), then you probably don't need to do this part # If you use a non-system copy of Python (eg. Sudo apt install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev Install the required dependencies and optionally install/update some libraries on your system: # Required dependencies These steps are copied (and slightly modified) from: OpenCV 3.1.0 + Python 3.5.2 + Ubuntu 16.04 is possible! Here's how. In addition, I use Ubuntu for most development so this answer will focus on that setup, unfortunately Since then, Python 3.5 has been released. Note: The original question was asking for OpenCV + Python 3.3 + Windows. Windows: pip3 install opencv-python opencv-contrib-python