Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to install cv2 on windows

Tags:

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).

like image 748
Kartik Verma Avatar asked Nov 29 '16 18:11

Kartik Verma


People also ask

Why cv2 is not installing?

The Python "ModuleNotFoundError: No module named 'cv2'" occurs when we forget to install the opencv-python module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install opencv-python command.

Why can't I import cv2 in python?

importerror no module named cv2 error occurs when cv2 module is not properly installed or its path is not properly set or configured. The straight way fix for this error (no module named cv2) is to reinstall this module (OpenCV-python). In some scenario reinstalling this module automatically remove the older version.


2 Answers

pip install opencv-python

you can type this instead of

pip install cv2 

it also works with anaconda pro

like image 114
pankaj yadav E DOT TECH Avatar answered Sep 18 '22 21:09

pankaj yadav E DOT TECH


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.

like image 36
Isha Firani Avatar answered Sep 21 '22 21:09

Isha Firani