We’re going to see in this tutorial how to install Python 3 and Opencv 4 on Windows.

Here below you see a list of the steps necessary for a complete installation. If you have any problem following the steps, I suggest you to watch the video tutorial above that will guide you trough it step by step.

Install Python 3:

We pick Python 3.6.8 which at the moment I’m writing this article (march 2019) is the best supported version by the other external libraries needed for computer vision.

  1. Download Python 3.6.8 from this link.
  2. Run the installation file.
  3. On the installation file remember to stick “Add Python 3.6 to PATH”.
  4. Click on “Install Now” and go ahead until you see the message “Setup was successfull”.

Install Opencv 4:

  1. Download the Opencv binary files here: https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
  2. Choose the compatible version of Opencv to your Python. We’ll download the lastest version of Opencv (4.1) for Python 3.6.8.
    How to understand the right version?
    -cp37m-win32.whl means that Opencv is for python 3.7 (32 bit version)
    -cp36m-win_amd64.whl means that Opencv is for python 3.6 (64 bit version)

  3. Run the “Command Prompt” of Windows. You can type “CMD” on the sarch bar to find it.
  4. Go to the directory where the Opencv binaries that you downloaded is located.
    cd YOURPATHfor example in my case:
    cd C:\Users\pinolo\Downloads
  5. Now let’s install the Opencv module using PIP.
    python pip -m install opencv_python‑4.0.1+contrib‑cp37‑cp36m‑win_amd64.whl
  6. Now let’s install Numpy using PIP.
    python pip -m install numpy
  7. The installation is complete. Now we can test it by running python and importing the libraries cv2 (for opencv) and numpy. If we don’t get any error it means that it has been installed succesfully.