opencv 问题记录

AttributeError: module ‘cv2’ has no attribute ‘ximgproc’

问题描述

安装opencv-contrib-python如下指令,报错

pip install opencv-contrib-python -i https://pypi.tuna.tsinghua.edu.cn/simple

ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.

原因分析:

虚拟环境下访问不到user,要改一下虚拟环境的配置


解决方案:

  1. Go to the pyvenv.cfg file in the Virtual environment folder

  2. Set the include-system-site-packages to true and save the change

  3. Reactivate the virtual environment.

安装opencv-contrib-python后依旧报错:AttributeError: module ‘cv2.cv2’ has no attribute ‘ximgproc’

原因分析:

问题发生的原因很有可能是电脑上除了opencv-contrib-python之外还有别的opencv包.

解决方案

把和opencv有关的库全部删了,就留一个opencv-contrib-python。opencv-contrib-python 和 opencv-python 是包含关系,不能同时存在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值