在安裝pyqt5相關的應用程序時,安裝成功后,運行出現以下錯誤:
QObject::moveToThread: Current thread (0x565030e64330) is not the object's thread (0x5650304ed930).
Cannot move to target thread (0x565030e64330)
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/linxu/Apps/Anaconda3/envs/Paddle/lib/python3.6/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.
這里的解決方法有兩個:
-
第一個是:因為OpenCV的版本過高,與pyqt5的讀寫不兼容
pip install opencv-python==4.2.0.32 -i https://pypi.tuna.tsinghua.edu.cn/simple
-
第二個是:可以安裝對應的依賴項
sudo apt-get install libxcb-xinerama0