安装了包opencv-contrib-python却仍然出现AttributeError: module ‘cv2.cv2‘ has no attribute ‘ximgproc‘问题的解决"/>
安装了包opencv-contrib-python却仍然出现AttributeError: module ‘cv2.cv2‘ has no attribute ‘ximgproc‘问题的解决
安装了包opencv-contrib-python
却仍然出现AttributeError: module 'cv2.cv2' has no attribute 'ximgproc'
问题的解决
如题, 问题的关键在于opencv
在python
上有4种不同的版本, 版本之间是不互相兼容的. 这些版本有
opencv-python
,opencv-contrib-python
,opencv-python-headless
,opencv-contrib-python-headless
.
问题发生的原因很有可能是电脑上除了opencv-contrib-python
之外还有别的opencv
包. 这时候我们通过命令
pip list
来看自己安装了哪些package
, 比如题主的电脑:
很显然这里多了一个opencv-python-headless
. 我们用下面的命令行将其卸载
pip uninstall opencv-python-headless
卸载完成后, 如图问题便解决了, 关键就在于卸载多余的opencv
包.
更多推荐
安装了包opencv-contrib-python却仍然出现AttributeError: module ‘cv2.cv2‘ has no attribute
发布评论