Disclaimers
- Tested on: Windows 7, Windows 10
- There could be other ways to get Open CV working on your Windows computer
Before installation
- Find you OS architecture
- Decide the Python version (e.g. 2.7 or 3.x)
- Install Anaconda, open terminal as administrator and , launch “python” and type “import numpy as np”, to test your installation
- Decide the version of Open CV you want to install, from the list of available versions
- Upgrade pip (use pip3 if using Python 3.x)
Find your OS architecture by issuing following command:
systeminfo | findstr /I type:
Install or Upgrade pip (or pip3 for Python 3.x):
python get-pip.py python -m pip install --upgrade pip
Installation
You can install Open CV using pip or manually. Installing Anaconda should already have taken care of dependencies for Open CV.
To find the list of available versions of Open CV through pip (or pip3) I use following:
pip install opencv_python==
Which prints an informative error message as following
Collecting opencv_python==
Could not find a version that satisfies the requirement opencv_python== (from versions: 3.1.0.0, 3.1.0.1, 3.1.0.2, 3.1.0.3, 3.1.0.4, 3.1.0.5, 3.2.0.6, 3.2.0.7, 3.2.0.8, 3.3.0.9, 3.3.0.10)
No matching distribution found for opencv_python==
If your version is in the list …
{
pip install 'opencv_python==x.x.x.x...'
… and done! Skip ahead to verification.
}
else If you want to install using (Ana)conda …
{
In Anaconda command prompt
conda install -c menpo opencv
// alternatives:
- conda install –channel https://conda.anaconda.org/menpo opencv3
- conda install -c https://conda.binstar.org/menpo opencv
source: Anaconda, Stackoverflow
}
else
{
But if you need to install a version(e.g. 2.4.9) that is not available through pip, you need to download that version, extract the files.
- Let’s say you extracted your files to C:\opencv folder, on a 64 bit operating Windows OS and you are using Python 2.7. Navigate to C:\opencv\build\python\2.7\x86
- Copy cv2.pyd file
- Navigate to Anaconda Python installation path, in my case C:\Users\WildClick\AppData\Local\Continuum\Anaconda2\Lib\site-packages
}
Verification
Start Python in Anaconda terminal, type
import cv2 cv2.__version__