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

通过重新

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

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

windows使用opencv报异常处理

Original: https://blog.csdn.net/m0_37570494/article/details/124708233
Author: 谷隐凡二
Title: windows使用opencv报异常处理

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/703815/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球