python报错合集记录

python报错合集记录,第1张

报错1:cv2.imshow('xxx', xxx)

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'

报错代码:

cv2.imshow('img_single', img_single)

报错内容:

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'

解决:

pip install opencv-contrib-python

显示成功:

 参考:

【常见问题】python调用cv2.imshow()显示图像失败(非路径问题)_8倍的博客-CSDN博客_cv2.imshow报错报错error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support.https://blog.csdn.net/W9XM96/article/details/123480838?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522165214519016782388052957%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=165214519016782388052957&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~top_click~default-2-123480838-null-null.142%5Ev9%5Epc_search_result_control_group,157%5Ev4%5Econtrol&utm_term=cv2.imshow%E6%8A%A5%E9%94%99&spm=1018.2226.3001.4187

2、报错:object of type 'MyDataset' has no len()

 我一直以为是在def __init__()里用了len(),导致出现的问题。结果是复写def __len__()时候,我写成了def len()。

无语了。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/915492.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-16
下一篇2022-05-16

发表评论

登录后才能评论

评论列表(0条)

    保存