Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named cv2.cv

python 3.5 and windows 10

I installed open cv using this command :

pip install opencv_python-3.1.0-cp35-cp35m-win_amd64.whl

This command in python works fine :

import cv2

But when i want to import cv2.cv :

import cv2.cv as cv

This error comes up :

import cv2.cv as cv
ImportError: No module named 'cv2.cv'; 'cv2' is not a package

So what is the problem and how can i fix it?

like image 977
Mohammad Zamanian Avatar asked Sep 16 '16 14:09

Mohammad Zamanian


People also ask

How do I fix No module named cv2?

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.


2 Answers

as @Miki said :

cv2.cv has been removed in OpenCV3 and functions have changed

And this is OpenCV3 Documention:https://docs.opencv.org/3.0-beta/index.html

like image 165
Mohammad Zamanian Avatar answered Oct 21 '22 00:10

Mohammad Zamanian


Try import cv2.cv2 as cv This worked for me to get past this error.

like image 28
user117127 Avatar answered Oct 20 '22 23:10

user117127