windows使用opencv报异常处理

使用opencv调用方法时,报异常:

cv.imshow('imshow', img)

cv2.error: OpenCV(3.4.1-dev) /home/yhc/workspace/tvm/opencv/opencv-src/modules/highgui/src/window.cpp:632: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function ‘cvShowImage’

使用,直接把国内源都贴上了:这个先把组件卸载了,再重新安装
 

pip uninstall opencv-contrib-python

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

当然之后会报这个错误:
Traceback (most recent call last):
  File "D:/pycharm/ten-test/leidianModel/leidianMethod.py", line 5, in <module>
    import cv2 as cv
  File "D:\python\lib\site-packages\cv2\__init__.py", line 9, in <module>
    from .cv2 import _registerMatType
ImportError: cannot import name '_registerMatType' from 'cv2.cv2' (D:\python\lib\site-packages\cv2\cv2.cp37-win_amd64.pyd)

通过重新

pip uninstall opencv-python-headless

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

则可正常使用

如果以上操作还不行,就是opencv版本与组件不匹配,则重复第一步操作的卸载opencv-contrib-python操作,然后把opencv-python直接卸载了

pip uninstall opencv-python
再重新安装

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

安装完成后,再重新安装第一步,之后方法正常使用不报错

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

谷隐凡二

相识便是缘,开启技术大门

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值