报错下面这些并且弹窗:
qt.qpa.xcb: could not connect to display localhost:13.0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" 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.
x11转发处理的是这种情况:我在服务器执行一个脚本,脚本中要画图,要显示窗口(比如matplotlib的plt.show())。显然服务器不能显示界面,但是可以通过x11转发,调用本地的资源,在本地画出图像。
由于我运行的脚本最开始是同事在win下编写测试的,于是我去检查了,并没有调用窗口、显示图像的内容(只是将图片保存,不涉及展示),那只能考虑是qt的问题。
参考:https://panfake.com/2020/03/qxcbconnection-could-not-connect-to-display/
这里我选择第二种方法,修改~/.bashrc(当前用户的环境变量设置),添加:
export QT_QPA_PLATFORM='offscreen'
然后source一下。
单纯关闭弹窗:
如果需要x11转发,参考:
https://www.cnblogs.com/tsfh/p/9022170.html
https://blog.csdn.net/OnlyLove_longshao/article/details/108147111
https://blog.csdn.net/every_step/article/details/120640384