

在网上搜索了一下出现此问题是没安装opencv-contrib-python,但我是早就下载了,打开cmd也能看到安装了,还是这样出错请问是什么问题?


关注程序报错如下:
AttributeError: module 'cv2.cv2' has no attribute 'ximgproc'
原因是缺少库
opencv-contrib-python
安装步骤及注意事项如下:
1. 有四种不同的 opencv 包
opencv-python
opencv-contrib-python
opencv-python-headless
opencv-contrib-python-headless
只能安装一个,多个安装包不兼容
2. 查看已安装的包
pip list
pip uninstall 包名
3. 载入 opencv-contrib-python 包
pip install opencv-contrib-python
如报以下错误解决方法如下
raise ReadTimeoutError(self._pool, None, 'Read timed out.') pip._vendor.urllib3.exceptions.
windows下,直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini,输入以下内容
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com
之后再载入包。
参考文章:
Anaconda中如何查看已安装的包
pip安装软件时报错
模块’cv2.cv2’没有属性’ximgproc’