安装了包opencv-contrib-python却仍然出现AttributeError: module ‘cv2.cv2‘ has no attribute ‘ximgproc‘问题的解决

编程入门 行业动态 更新时间:2024-10-27 18:23:18

<a href=https://www.elefans.com/category/jswz/34/1771099.html style=安装了包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'问题的解决

如题, 问题的关键在于opencvpython上有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

本文发布于:2023-07-28 15:43:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1239050.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:安装了   contrib   python   AttributeError   opencv

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!