cv2.imshow("Result", img)错误/error

​​​​​​​​​​​
Traceback (most recent call last):
File “E:\pythonProject\lianxi\图片匹配\test.py”, line 16, in
cv2.imshow(“Result”, img)
cv2.error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:1272: 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’

我的系统是window系统,用的pycharm,python版本是3.9.4,opencv版本号是4.7.0.68
■opencv_ contrib. python-4.7.0.68.dist-info
■opencv
contrib_ python headless-4.7.0.68.dist-info
■opencv_ python-4.7.0.68.dist-info
■opencv_ python. headless-4.7.0.68.dist-info
我想知道报这个错的解决办法是啥,问题是在哪里,我有点晕了。

My system is a window system. It uses pycharm. The python version is 3.9.4, and the opencv version number is 4.7.0.68

■opencv_ contrib. _ python-4.7.0.68.dist-info

■opencv_ contrib_ python headless-4.7.0.68.dist-info

■opencv_ python-4.7.0.68.dist-info

■opencv_ python. headless-4.7.0.68.dist-info

I want to know what is the solution to this error and where is the problem. I’m a little dizzy. :cry:

you’ve installed far too many (4 !) opencv versions on the same machine. uninstall them all, then pick exactly one
(probably : pip install opencv_contrib_python )

((also, just saying: the ‘headless’ versions are for e.g. webservers, no gui there !))

1 Like

谢谢你的方法,解决了我的问题,非常感谢 :pray:
Thank you for your method and solving my problem. Thank you very much

1 Like