7

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?

3
  • 4
    if I remember correctly cv2.cv has been removed in OpenCV 3. You just need cv2
    – Miki
    Commented Sep 16, 2016 at 14:56
  • so i should replace cv with cv2 in the whole code? Commented Sep 16, 2016 at 14:57
  • Yes. You may have used cv2.cv for old legacy functions... in this case they won't be in cv2 and you should use the new function instead.
    – Miki
    Commented Sep 16, 2016 at 14:59

2 Answers 2

5

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

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.