我使用pyqt5和opencv创建了一个gui应用程序。应用程序在不激活虚拟环境的情况下工作正常,但当我激活虚拟环境并运行应用程序时,它会显示以下错误:
QObject::moveToThread: Current thread (0x125b2f0) is not the object's thread (0x189e780).
Cannot move to target thread (0x125b2f0)
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/deepak/Desktop/SampleApp/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
我尝试运行一个示例pyqt5代码(不导入opencv)和另一个代码(仅使用opencv),这两个代码在虚拟环境中都运行良好。
操作系统:parrot os 4.11
python版本:3.9.2
1条答案
按热度按时间b91juud31#
问题在于编译opencv时使用的qt版本与pyqt5使用的版本不同,从而导致冲突。
一个可能的解决方案是指示使用pyqt5使用的qt插件。
对于pyside2: