21

I am trying to install opencv in python on my windows machine but I am unable to do so. I have python 2.7.11::Anaconda 2.4.1 <32-bit>

Here is what I have tried till now -

  1. pip install cv2 on command line gives the error :

could not find a version that satisfies the requirement cv2

  1. I downloaded the package from sourceforge site, followed the steps and pasted cv2.pyd in C:\Python27\Lib\site-packages but still it is not working. I get the following error message

ImportError: No module named cv2

(I already have numpy installed and it works just fine).

bad_coder
  • 11,289
  • 20
  • 44
  • 72
Kartik Verma
  • 219
  • 1
  • 2
  • 5

5 Answers5

43
pip install opencv-python

you can type this instead of

pip install cv2 

it also works with anaconda pro

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
2

Try

pip install opencv-python==4.3.0.36
Elango Sk
  • 51
  • 4
1

I was able to solve the error.

If you are using python version 3 , sometimes you have to use pip3.

pip3 install opencv-python

enter image description here

Make sure you are using python 3 , it won't work for python 2.

Adrian W
  • 4,563
  • 11
  • 38
  • 52
0

So I was using PyCharm, and what worked for me was to install it directly from file->settings, Project:your-project-name->Python Interpreter list

  • This seems like your pycharm project is configured to run with a different python version than pip uses by default – Neuron Dec 06 '22 at 13:08
0

You can use the:

pip install opencv-contrib-python

You can also use the pip3 install opencv-python command