Skip to content →

How to install OpenCV (Python) on Windows?

I happened to write this post when I was trying to install OpenCV for python, following the instructions on the official website. Sadly bad hyperlinks on their site made me write this blog post.

You can simply download the exes for the prerequisites and have a gala time, but I’d rather tell you how to install pip and then install OpenCV.

  1. Python 2.7 : Download here and install to the default location. (C:\Python27)
  2. Install PIP
    • Download get-pip.py
    • Open CMD/Python IDLE and run the following command
      python get-pip.py
    • Add pip to your environment variables
      • Right click on start icon, click on System, then click on Advanced System Settings
      • Click on Environment Variables
      • Under System Variables, select path and click edit
      • Add a new path C:\Python27\Scripts
  3. Open CMD and type pip install numpy. This will install the latest numpy  on your pc.
    • Open Python IDLE, and run the following to check if numpy is working properly.
      import numpy
      print numpy.__version__
  4. Download OpenCV from here
    • Once downloaded, extract the files and open the folder, goto build/python/2.7/x86  and copy cv2.pyd to C:\Python27\Lib\site-packages
    • To check if OpenCV is working properly do the same as in step 3
    • import cv2
      print cv2.__version__

Published in Installation Python

Comments

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.