gpt4 book ai didi

python - qt.qpa.plugin : Could not load the Qt platform plugin "xcb", 不能初始化Qt平台,但是 "Available platform plugins are: xcb, eglfs......"

转载 作者:行者123 更新时间:2023-12-04 18:48:08 31 4
gpt4 key购买 nike

我正在尝试使用 Qt 和 opencv 运行创建 UI 的脚本。
但是,这是我得到的一个奇怪的错误

python3 dashboard.py 
QObject::moveToThread: Current thread (0xaffdf0) is not the object's thread (0x552f790).
Cannot move to target thread (0xaffdf0)

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.

Aborted (core dumped)
这是 ldd-ing libqxcb.so 的输出
ldd libqxcb.so 
linux-vdso.so.1 (0x00007ffdbfbf5000)
libQt5XcbQpa-ca221f44.so.5.15.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libQt5XcbQpa-ca221f44.so.5.15.0 (0x00007f32102a5000)
libfreetype-c0e61f0c.so.6.14.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libfreetype-c0e61f0c.so.6.14.0 (0x00007f320ffd9000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f320ffa9000)
libQt5Gui-ba0a2070.so.5.15.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libQt5Gui-ba0a2070.so.5.15.0 (0x00007f320f6a1000)
libQt5Core-39545cc7.so.5.15.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libQt5Core-39545cc7.so.5.15.0 (0x00007f320ef9c000)
libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007f320ef14000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f320eef2000)
libX11-xcb-69166bdf.so.1.0.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libX11-xcb-69166bdf.so.1.0.0 (0x00007f320ecef000)
libxcb-icccm-413c9f41.so.4.0.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libxcb-icccm-413c9f41.so.4.0.0 (0x00007f320eae9000)
libxcb-image-e82a276d.so.0.0.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libxcb-image-e82a276d.so.0.0.0 (0x00007f320e8df000)
libxcb-shm-7a199f70.so.0.0.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libxcb-shm-7a199f70.so.0.0.0 (0x00007f320e6d9000)
libxcb-keysyms-21015570.so.1.0.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libxcb-keysyms-21015570.so.1.0.0 (0x00007f320e4d5000)
libxcb-randr-a96a5a87.so.0.1.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libxcb-randr-a96a5a87.so.0.1.0 (0x00007f320e2be000)
libxcb-render-util-43ce00f5.so.0.0.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libxcb-render-util-43ce00f5.so.0.0.0 (0x00007f320e0b8000)
libxcb-render-637b984a.so.0.0.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libxcb-render-637b984a.so.0.0.0 (0x00007f320dea2000)
libxcb-shape-25c2b258.so.0.0.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libxcb-shape-25c2b258.so.0.0.0 (0x00007f320dc9c000)
libxcb-sync-89374f40.so.1.0.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libxcb-sync-89374f40.so.1.0.0 (0x00007f320da93000)
libxcb-xfixes-9be3ba6f.so.0.0.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libxcb-xfixes-9be3ba6f.so.0.0.0 (0x00007f320d887000)
libxcb-xinerama-ae147f87.so.0.0.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libxcb-xinerama-ae147f87.so.0.0.0 (0x00007f320d682000)
libxcb-xkb-9ba31ab3.so.1.0.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libxcb-xkb-9ba31ab3.so.1.0.0 (0x00007f320d459000)
libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f320d42f000)
libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x00007f320d41a000)
libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007f320d2dc000)
libSM.so.6 => /lib/x86_64-linux-gnu/libSM.so.6 (0x00007f320d2d1000)
libICE.so.6 => /lib/x86_64-linux-gnu/libICE.so.6 (0x00007f320d2b4000)
libxkbcommon-x11-c65ed502.so.0.0.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libxkbcommon-x11-c65ed502.so.0.0.0 (0x00007f320d0a5000)
libxkbcommon-71ae2972.so.0.0.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libxkbcommon-71ae2972.so.0.0.0 (0x00007f320ce64000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f320ce5d000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f320cc44000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f320caf6000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f320cadb000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f320c8ed000)
libgthread-2.0.so.0 => /lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f320c8e8000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f320c7b2000)
libbz2-a273e504.so.1.0.6 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libbz2-a273e504.so.1.0.6 (0x00007f320c5a1000)
libpng15-ce838cd1.so.15.13.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libpng15-ce838cd1.so.15.13.0 (0x00007f320c374000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3210533000)
libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007f320c2ba000)
libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007f320c286000)
libxcb-util-4d666913.so.1.0.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libxcb-util-4d666913.so.1.0.0 (0x00007f320c07f000)
libXau-00ec42fe.so.6.0.0 => /home/aevas/Desktop/pyenvs/newpy39/lib/python3.9/site-packages/cv2/qt/plugins/platforms/./../../../../opencv_python.libs/libXau-00ec42fe.so.6.0.0 (0x00007f320be7a000)
libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007f320be72000)
libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f320be6a000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f320be61000)
libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f320be49000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f320bdd3000)
libmd.so.0 => /lib/x86_64-linux-gnu/libmd.so.0 (0x00007f320bdc4000)
pip 列表,只抓取 opencv 和 qt 的东西
opencv-python           4.5.5.62
PyQt5 5.15.6
PyQt5-Qt5 5.15.2
PyQt5-sip 12.9.1

我也查阅了这些链接,但无济于事:
  • https://github.com/Yuliang-Liu/Curve-Text-Detector/issues/11
  • https://forum.qt.io/topic/93247/qt-qpa-plugin-could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/65 (已经完成了所有 sudo apt-get install )
  • https://unix.stackexchange.com/questions/338519/how-to-install-libxcb (我还执行了所需的 sudo apt-get 安装)
  • How to fix the error "QObject::moveToThread:" in opencv in python? (pip 不允许我安装旧版本的 opencv-python)
  • https://www.programmersought.com/article/20797211182/ (也关于降级opencv,我无法做到)
  • 从 python 站点包的“cv2”安装中删除“qt”文件夹似乎可以使其工作。但是,这会使其他依赖于 opencv_python 的东西崩溃。
  • 最佳答案

    我只是安装旧版本的 opencv-python==4.3.06。
    通过使用:

    pip uninstall opencv-python

    pip install opencv-python==4.3.06
    在那之后 。 qt 错误消失。
    如果你不能使用 pip 来卸载。也许你是用 conda 来安装 cv 的?

    关于python - qt.qpa.plugin : Could not load the Qt platform plugin "xcb", 不能初始化Qt平台,但是 "Available platform plugins are: xcb, eglfs......",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71108315/

    31 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com