How to install Python 3 and Opencv 4 on Windows
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.
- Download Python 3.6.8 from this link.
- Run the installation file.
- On the installation file remember to stick “Add Python 3.6 to PATH”.
- Click on “Install Now” and go ahead until you see the message “Setup was successfull”.
Install Opencv 4:
- Download the Opencv binary files here: https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
- 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)
- Run the “Command Prompt” of Windows. You can type “CMD” on the sarch bar to find it.
- Go to the directory where the Opencv binaries that you downloaded is located.
cd YOURPATHfor example in my case:
- Now let’s install the Opencv module using PIP.
python pip -m install opencv_python‑4.0.1+contrib‑cp37‑cp36m‑win_amd64.whl
- Now let’s install Numpy using PIP.
python pip -m install numpy
- 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.
This site uses Akismet to reduce spam. Learn how your comment data is processed.
I’ve just launched the shop.
If you’re a beginner and you need a device to start learning computer vision, the Jetson Nano COMPUTER VISION PACK might be a good solution for you.
You can go on the shop to buy it!