【问题标题】:qt.qpa.plugin: Could not find the Qt platform plugin "wayland"qt.qpa.plugin:找不到 Qt 平台插件“wayland”
【发布时间】:2021-11-16 18:43:53
【问题描述】:

我正在尝试浏览一些图像识别教程,但我一直遇到这个错误,这使我无法继续。我正在运行 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 问题。任何帮助将不胜感激。

【问题讨论】:

    标签: ubuntu


    【解决方案1】:

    在运行 Sway 作为窗口管理器的 Arch Linux 上尝试启动 OBS Studio 27.1.3 时遇到了非常类似的错误。 OBS 产生了这个错误:

    qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
    

    This bug report 表示我缺少通过安装修复的依赖项qt5-wayland

    pacman -S qt5-wayland
    

    之后,OBS 运行正常,可以录屏和录音。

    【讨论】:

    • 这让我找到了正确的方向!对我来说,缺少的 Arch 包是 qt6-wayland,因为我的项目使用的是 QT6。
    【解决方案2】:

    升级到 Ubuntu 21.10(从 20.10 开始)后,我遇到了同样的问题。

    安装旧版本的 OpenCV 对我有用。

    pip install opencv-python==4.3.0.38
    

    【讨论】:

      【解决方案3】:

      我在尝试使用 Wayland 启动 KeepassXC 2.6.6 时遇到了同样的问题:

      QT_QPA_PLATFORM=wayland keepassxc
      Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
      qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
      

      我的 Ubuntu 21.10 上的解决方案是安装 qtwayland5:

      sudo apt install qtwayland5
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-10-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-09-03
        • 2020-06-25
        • 1970-01-01
        • 2022-06-23
        相关资源
        最近更新 更多