ubuntu 22.4 使用 QT错误 pyside错误
问题1: QObject::moveToThread: Current thread is not the object`s thread. Cannot move to target thread解决:步骤1:conda install pyqt步骤2:apt-get install libxcb-xinerama0步骤3:sudo pip3 uninstall opencv-pythonpip
·
问题1: QObject::moveToThread: Current thread is not the object`s thread. Cannot move to target thread
解决:
步骤1:
conda install pyqt
步骤2:
apt-get install libxcb-xinerama0
步骤3:
sudo pip3 uninstall opencv-python
pip3 install opencv-contrib-python
sudo apt-get install libopencv-dev python-opencv
步骤4:
这一步处理一定要灵活!!! 网络上很多都是基于pyqt的, 而我们是pyside, 所以在你就不能去pyqt下找qt文件夹, 比如我, 我需要使用pyside2,那么就去PySide2下去找platform
相反, 如果你就是使用pyqt/cv2, 那么就在site-packages下找pyqt/cv2的, 千万不要混淆!!!
(可以直接通过pwd命令得到当前文件夹的路径)
envpath = '/home/***看上面的图,替换为自己的路径***/qt/plugins/platform'
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = envpath
问题2 Could not load the Qt platform plugin “xcb” in “/home/yannqi/.local/lib/python3.8/site-packages/cv2/qt/plugins” even though it was found
sudo apt-get install build-essential libgl1-mesa-dev
然后按问题1的步骤来一遍
同时, 注意qt的设置:
检查这些栏目是否都有, 本人就是一开始没有这个QT Versions,后来又通过安装包重新安装后才可以检测到
像KITS, Debuggers里面的栏目都检查下,
这里我选用的是Clang,可以正常运行
更多推荐
已为社区贡献1条内容
所有评论(0)