报错AttributeError: module ‘cv2‘ has no attribute ‘ximgproc‘

报错AttributeError: module 'cv2' has no attribute 'ximgproc'

首先查看是否安装opencv-contrib-python

复制代码
pip list | grep opencv

显示

复制代码
opencv-contrib-python             4.4.0.46             
opencv-python                     4.8.1.78             
opencv-python-headless            4.7.0.72

说明本机上已经成功安装 opencv-contrib-python, opencv-python ,opencv-python-headless模块,但是为什么还会报错module 'cv2' has no attribute 'ximgproc'呢?

由于版本不一致的问题导致的。

将opencv-contrib-python升级为 opencv-python 一致的版本即可解决

复制代码
pip install opencv-contrib-python==4.8.1.78

解决后,再测试查看各模块版本为:

复制代码
pip list | grep opencv

显示

复制代码
opencv-contrib-python             4.8.1.78             
opencv-python                     4.8.1.78             
opencv-python-headless            4.7.0.72 
相关推荐
tkokof11 天前
捉虫(Bug)小记
人工智能·深度学习·bug·游戏开发
南宫萧幕1 天前
基于上一篇文章VMware+openweb UI+ollama+docker的bug问题总结
docker·容器·bug·openweb ui
呼啦啦5611 天前
测试(BUG篇)
bug
ZC跨境爬虫1 天前
3D地球卫星轨道可视化平台开发Day2(轨道错位Bug修复+模块化结构优化)
前端·3d·html·json·bug
柠檬07111 天前
记录bug :C++调用python 路径问题
c++·python·bug
初圣魔门首席弟子3 天前
bug20260415
c++·bug
万粉变现经纪人3 天前
如何解决 pip install flash-attention 报错 需要 SM_80+(Ampere)架构 问题
python·架构·django·bug·virtualenv·pip·pygame
zhanglianzhao4 天前
Gazebo仿真机器人和相机时Gazebo ROS Control 插件偶发性加载失败bug分析
机器人·bug·ros·gazebo·ros_control
techdashen4 天前
Go 1.25 新特性:Flight Recorder —— 像黑匣子一样捕捉线上 Bug
java·golang·bug
悟空爬虫-彪哥5 天前
VRCFaceTracking安装和iPhone面捕配置教程,有bug
ios·bug·iphone