How to install OpenCV on Windows 10 and Python 3.6

Last modified date

Comments: 0

I remember, my first time I installed OpenCV was trivial and complicated. Didn’t know what a whell file was or how to use pip. Right while I am writing this tutorial, few months passed and install a library is, most of the times, painless. Let’s see together how to install OpenCV on Windows 10.

NOTE: this tutorial is a copy-paste of the original one I wrote on Stackoverflow.

Install Python 3.6 and check it was added to PATH (do a simple Google research on how to verify/do this task).

Download OpenCV wheel file from Gohlke’s site.

In the folder you downloaded the file, press SHIFT+RIGHT CLICK and choose “Open console here”. Copy-paste the name of the .whl file and, in CMD, type pip install <name of the file.whl>.

Depending of what you use (Pydev or Pycharm in this case), open your IDE and type import cv2. It probably won’t work…

For Eclipse (with PyDev):

Create firs a project and then do the following:

 

opencv-inst-1

 

For PyCharm:

cv2 module probably won’t work. Go to the Python folder/Lib/site-packages/cv2 and copy the file cv2.cp36-win_amd64.pyd to the site-packages folder. Rename it cv2.pyd

 

opencv-inst-2

 

Now try to write a command… cv2.imread(). If auto-completition don’t work, try cv2.cv2.imread(). This will work for sure.

Hope you enjoyed. This worked form me in the time I was writing the tutorial. It must be sayed that there are many variables which could make these steps useless in the future.

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment