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 successful”.
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 latest 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:
cd C:\Users\pinolo\Downloads - 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 successfully.


Hi there, I’m the founder of Pysource.
I’m a Computer Vision Consultant, developer and Course instructor.
I help Companies and Developers to build efficient computer vision software.



How do I open OpenCV after this? Assuming what you did here was converting the linux version to window, where did it generate the exe?
Actually OpenCV is not an executable application with a GUI. Rather it is a library for Python and C++ and other languages.
So basically, you can import opencv library into your Python code and use it. For OpenCV commands and keywords to use in Python, you can refer OpenCV documentations.
There are many tutorials in pysource.com , https://www.tutorialspoint.com/opencv/index.htm , https://www.pyimagesearch.com/2018/07/19/opencv-tutorial-a-guide-to-learn-opencv/ , https://pythonprogramming.net/loading-images-python-opencv-tutorial/ and lot more.
I hope I got you correctly.
Thanks
Only this worked for me
python -m pip install opencv_python‑4.0.1+contrib‑cp37‑cp36m‑win_amd64.whl
not this
python pip -m install opencv_python‑4.0.1+contrib‑cp37‑cp36m‑win_amd64.whl
thank you very much, same thing worked for me too
thank you 🙂 this worked for me too
same
i am installing this command is OK:
python pip -m install opencv_python‑4.1.1+contrib‑cp36‑cp36m‑win_amd64.whl
Thank you your information is very useful
thanks a lot!.. saved me a lot of headache
Worked for me… Thankz a lot…
I followed this tutorial and everything works fine on my machine!!
Thank you very much!!!
Andrea
C:\Users\Lyall\Downloads\opencv\build\python\cv2
I have got this file on my computer but when i ask cmd admin to “import cv2” it comes back “no module named ‘cv2’
yet here it is in my files??? how do i proceed?
I cannot download opencv library if possible can u help me
Hi Sergio. How can I use Pycharm after this? Do I need to install OpenCV again or should I add it somehow?
It would be great if you could provide an example.
Thanks!!!
Excellent tuto; quick and simple.
Worked perfectly with >python -m pip install … for both installations
Thanks.
HEllo
which version is good for python 3.7 ?
Hii, may i know is there any different of features for the installed opencv using this method and the cmake method ? Glad to have you answer my question, i am new to these things.
Hi! I want to develop a look-based media player(if a face detects video play else pause ), volume and next/previous are controlled through hand gesture. I want to use python and c# languages. What tools should I use and how I can connect python andC#? plz, guide me from start. thnx in advance
For me the only thing that succeed was to open anaconda prompt and type:
pip install opencv_python-4.2.0-cp37-cp37m-win_amd64.whl
Dear sir,
opencv python-4.1.0+contrib-cp36-cp36m-win amd64.whl file is not there
(https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv ).
Please tell me what do I do.
what’s wrong in
pip install opencv-python
It worked for me
What IDE do you Recommend for opencv-python? which one are you usinG?
I use Pycharm
Thank you 🙂
Thank you so much! The only solution that worked for me.
Thank you so much for providing this useful step-by-step tutorial. Everything went smooth as expected.
>>> import cv2
Traceback (most recent call last):
File “”, line 1, in
ImportError: DLL load failed: The specified module could not be found.
i got this error while importing cv2.