当前位置:   article > 正文

Python 使用cv2模块 进入视觉识别的报错,报错信息为AttributeError: module ‘cv2.cv2‘ has no attribute ‘bgsegm_attributeerror: module 'cv2' has no attribute 'bgs

attributeerror: module 'cv2' has no attribute 'bgsegm

Python 使用cv2模块 进入视觉识别的报错,报错信息为AttributeError: module ‘cv2.cv2’ has no attribute 'bgsegm

image.png

问题描述——cv2模块 进入视觉识别的报错,报错信息为AttributeError: module ‘cv2.cv2’ has no attribute 'bgsegm

image.png

问题原因

网上看了不少文章发现是少了这个模块导致的

后面使用命令安装模块就可以解决,

pip install opencv-contrib-python
  • 1

但是我这边早就安装了这个模块,还是报错

image.png

后面发现opencv安装顺序可以不对,导致识别不到这个模块

解决方法

使用下面命令重新安装

pip uninstall opencv-python
pip uninstall opencv-contrib-python
pip install opencv-contrib-python
  • 1
  • 2
  • 3

image.png

测试代码如图

image.png

问题解决,

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号