How to install Python 3 and Opencv 4 on Windows
Install Python 3:
1) Download the latest version of python on python.org
2) Run the installation file. And choose “Customize installation”
3) Click “Next”
4) Select the installation Path.
I suggest to use: C:\Python37-32 (where 37-32 it’s your version of python), as it’s a really short path and easier to call it anytime we need it.
5) Installation done.
Install Opencv 4:
1) Download the Opencv binary files here: https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
2) Choose The latest version of Opencv (at the moment I’m writing this post it’s 4.0.1), for your version of Python and download it.
–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.
for example in my case:
5) Now let’s install the module.
Let’s run pip from the folder where you installed python.
for example if you have python on:
you will run it this way:
C:\Python37-32\Scripts pip install opencv_python‑4.0.1+contrib‑cp37‑cp37m‑win32.whl
6) Now let’s download and install Numpy (a library that it’s necessary to run Opencv).
Download here https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
7) Let’s install the Numpy library the same way we installed Opencv before, typing on the prompt command:
C:\Python37-32\Scripts pip install numpy‑1.16.2+mkl‑cp37‑cp37m‑win32.whl
8) 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.