cv2.imshow error: The function is not implemented. Rebuild the library with Windows…

在python中调用cv2.imshow,出现这个一个报错:

cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:1268: 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’

解决办法:安装 opencv-contrib-python

pip install opencv-contrib-python

Collecting opencv-contrib-python
Downloading opencv_contrib_python-4.6.0.66-cp36-abi3-win_amd64.whl (42.5 MB)
|████████████████████████████████| 42.5 MB 234 kB/s
Requirement already satisfied: numpy>=1.17.3 in e:\anaconda3\envs\torch\lib\site-packages (from opencv-contrib-python) (1.21.5)
Installing collected packages: opencv-contrib-python
Successfully installed opencv-contrib-python-4.6.0.66

PS: 看源码,imshow正常来讲是在highgui中的,不会依赖contrib。不清楚是否是最新的库中调用了新的函数。

Original: https://blog.csdn.net/tanmx219/article/details/125458636
Author: 高精度计算机视觉
Title: cv2.imshow error: The function is not implemented. Rebuild the library with Windows…

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

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

(0)

大家都在看

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