[Solved] Python: How to pip install opencv2 with specific version 2.4.9?

I know that I could pip install opencv-python which installs opencv3, but is there a separate command or name for opencv specific version such as 2.4.9?

If not, how can I specify which version to install?


Solution #1:

Via pip you can specify the package version to install using the following:

pip install opencv-python==2.4.9

However, that package does not seem to be available on pypi.

A little trick for checking available versions:

pip install opencv-python==

Which returns:

Could not find a version that satisfies the requirement opencv-python==
(from versions:,,, 3.1 .0.3,,, No matching distribution found for opencv-python==

Respondent: etemple1

Solution #2:

Easy and simple

  • Prerequisites
    • pip install matplotlib
    • pip install numpy
  • Final step
    • pip install opencv-python

Specific version
* Final step
* opencv-python==2.4.9

Respondent: Abdul Sheikh

Solution #3:

There’s another easy way, you can type in terminal

sudo apt-get install python-opencv

Install OpenCV-Python in Ubuntu

After installing it, you can use opencv version 2.4 in both c++ and python.

But I recommend you should use opencv 3.2.0 and opencv-contrib, it gives more features

Hope this can help!

Respondent: Vinh Trieu

Solution #4:

cv2 vs. “opencv3”

To get a potential misunderstanding out of the way:
The python OpenCV module is named and imported via import cv2 in all versions > 2.0, including > 3.0. If you want to work with cv2, installing OpenCV versions > 3 is fine – unless you’re looking for specific compatibility with older versions or are a fan of the 2.4.x versions. The switch from 2.4.x to 3.x was in 2015 and in terms of features, speed and transparency, it makes much sense to use the newer versions. You can read here and here about major differences. 2.4.x versions are still supported though, current release is

Installing a specific version, e.g. OpenCV 2.4.9

That said:
If you want to install a specific version that neither pip install opencv-python==2.4.X, sudo apt-get install opencv nor conda install opencv=2.4.x provide (as explained by other answers here), you can always install from sources. In the sourceforge repository you can find all major versions for each operating system. Although for unxeperienced users this might be scary, it is well explained in some tutorials. E.g. here for 2.4.9 on Ubuntu 14.04. Or here is the official Linux install doc for the latest release

In essence, the install process boils down to:

  1. install dependencies, refer to docs (e.g. here) for required packages

  2. get sources from OpenCVs sourceforge

    e.g. wget

  3. unzip sources and prepare build by creating build directory and running cmake

    mkdir build
    cd build
    cmake (... your build options ...)
  4. build in the created build directory with:

    sudo make install
Respondent: Honeybear

Solution #5:

You can also do it using Anaconda:

conda install -c opencv=2.4.9
Respondent: Archie

Solution #6:

If you are using windows os, you can download your desired opencv unofficial windows binary from here, and type
something like pip install opencv_python- in the directory of binary file.

Respondent: kai06046

Solution #7:

you can try this

pip install opencv==2.4.9
Respondent: Rhythm sharma

Solution #8:

python3.6 -m pip install opencv-python

will install cv2 in linux in branch python3.6

Respondent: vishal

Solution #9:

python -m pip install opencv-python

which will install opencv based on your current python

Respondent: tech-gayan

Solution #10:

If you’re a Windows user, opencv can be installed using pip, like this:

pip install opencv-python==<python version>

ex - pip install opencv-python==3.6

If you’re a Linux user:

sudo apt-get install python-opencv

At the same time, opencv can be installed using conda like this…

conda install -c opencv=3.6
Respondent: GT_hash

Solution #11:

Below Python packages are to be downloaded and installed to their default locations.

1.1. Python-2.7.x.

1.2. Numpy.

1.3. Matplotlib (Matplotlib is optional, but recommended since we use it a lot in our tutorials).

Install all packages into their default locations. Python will be installed to C:/Python27/.

After installation, open Python IDLE. Enter import numpy and make sure Numpy is working fine.

Download latest OpenCV release from sourceforge site and double-click to extract it.

Goto opencv/build/python/2.7 folder.

Copy cv2.pyd to C:/Python27/lib/site-packeges.

Open Python IDLE and type following codes in Python terminal.

import cv2
print cv2.version
If the results are printed out without any errors, congratulations !!! You have installed OpenCV-Python successfully.

Respondent: amit ghosh

Solution #12:

The following command line pip install opencv-python== works properly. Use one of the versions presented to you. May be:,,,,,,, or, etc.

To make sure, you can see my screenshot.screenshot

Respondent: Al hamdulillah

Solution #13:

First, get the correct opencv version extension which you want to install. If you want to install then run pip install opencv-python==

Respondent: sai

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy