当我们通过ssh连接服务器时,会出现以下问题
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "xxxxx" 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.
这是因为默认的bash是无法通过ssh可视化的。解决方法如下:
参考这个vscode远程连接服务器+MobaXterm实现可视化结果回传
一、服务器端
1.在通过wine安装mobaxterm
在通过wine安装mobaxterm,教程为安装教程
2.配置mobaxterm
安装了MobaXterm后,在Settings->Configuration->X11将X11 remote access选项改选为full。
3.配置
sudo vim /etc/ssh/sshd_config
在打开的文件中修改:
X11Forwarding yes
X11UseLocalhost no #禁止将X11转发请求绑定到本地回环地址上
4.设置环境变量
在ubuntu左下角打开所有程序-打开MobaXterm-开启终端后输入:
export DISPLAY=10.42.0.xxx:0.0
# 10.42.0.xxx为需要显示的客户端IP地址
# 0.0代表X server在本机6000端口
二、客户端(需要显示的一端)
1.安装Remote X11
在vscode软件中的extensions中搜索Remote X11,并点击安装。
2.配置config
打开remote-ssh设置。(在~.ssh\config)
在config文件中添加3行设置:
ForwardX11 yes
ForwardX11Trusted yes
ForwardAgent yes
3.使用
不需要配置ip地址,DISPLAY什么的,直接打开终端用就可以显示了。
3781






