Python 导入错误:没有名为 cv2.cv 的模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39534496/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 22:23:52  来源:igfitidea点击:

ImportError: No module named cv2.cv

pythonpython-3.xopencvwindows-10

提问by Mohammad Zamanian

python 3.5 and windows 10

python 3.5 和 Windows 10

I installed open cv using this command :

我使用以下命令安装了 open cv:

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

This command in python works fine :

python中的这个命令工作正常:

import cv2

But when i want to import cv2.cv :

但是当我想导入 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?

那么问题是什么,我该如何解决?

采纳答案by Mohammad Zamanian

as @Miki said :

正如@Miki 所说:

cv2.cvhas been removed in OpenCV3 and functions have changed

cv2.cv已在 OpenCV3 中删除,功能已更改

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

这是 OpenCV3 文档:https://docs.opencv.org/3.0-beta/index.html