ubuntu系统下运行程序出现bug 已放弃 (核心已转储)

ubuntu系统下运行程序出现bug 已放弃 (核心已转储)
用代码块功能插入代码,请勿粘贴截图
运行以后报错: QObject::moveToThread: Current thread (0x8c9a160) is not the object's thread (0x8aa4b00).

Cannot move to target thread (0x8c9a160)
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/zml/anaconda3/envs/tf/lib/python3.8/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, minimal, minimalegl, offscreen, vnc, webgl.

看到网上有win系统下的解决方法,找到文件然后添加路径。可是我根据文件夹提示,找到相关文件发现跟win系统下显示的不一致。

img

这是同类报错的一种思路,提供给你做参考
解决方案:
openCV降级
卸载pip uninstall opencv-python
安装pip install opencv-python==4.1.2.30

修改配置文件~/.bashrc,在终端中输入以下命令:

vim ~/.bashrc
在文件最末尾添加如下语句:
export QT_DEBUG_PLUGINS=1
保存,退出文件,执行
source ~/.bashrc
使配置生效
详见:
https://www.jb51.net/article/193024.htm