我正在尝试运行一些图像识别教程,但是我一直遇到这个错误,阻止我继续。我运行的是Ubuntu 21.10和Python 3.9.7。我的代码就是这样的。
import cv2
img=cv2.imread("path",1)
#print(type(img))
#print(img)
#print(img.shape)
#print(img.ndim)
cv2.imshow("Moon",img)
cv2.waitKey(2000)
更重要的是,这是我得到的错误:
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "/home/peepo/.local/lib/python3.9/site-packages/cv2/qt/plugins"
我去了路径中的文件夹,果然,Wayland不在那里。我已经搜索了一段时间,现在安装了几个不同的东西,从解决方案的人经历类似的事情,我在网上找到的。没有工作。
目前我正在寻找是否有一些手动下载的地方,我可以直接拖放到文件夹中。我读到新版本的Ubuntu和qt4有一些问题,所以我不确定这是Ubuntu还是Python的问题。任何帮助都将不胜感激。
4条答案
按热度按时间xriantvc1#
我在运行Sway作为窗口管理器的Arch Linux上启动OBS Studio 27.1.3时遇到了一个非常类似的错误,OBS产生了这个错误:
This bug report表明我缺少依赖项
qt5-wayland
,我通过安装它修复了这个依赖项:后来,OBS运行得很好,它能够记录屏幕和音频。
7vhp5slm2#
我在尝试使用Wayland启动KeepassXC 2.6.6时遇到了同样的问题:
Ubuntu 21.10和22.04上的解决方案是安装
qtwayland5
:46scxncf3#
我在升级到Ubuntu 21.10(从20.10)后遇到了同样的问题。
安装一个旧版本的OpenCV对我很有效。
shstlldc4#
在ubuntu 22中,在/etc/environment中设置系统变量:第一个月