运行cv程序时报错cvShowImage
之前正常运行的cv程序,今天突然跑不了了,报错如下:cv2.error: OpenCV(4.11.0) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:1301: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa 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 list 命令查看列表里是否存在opencv-python和opencv-python-headless两个包
-
再使用pip uninstall opencv-python opencv-python-headless命令删除这两个包
-
然后使用pip install opencv-python