1. remote ssh的配置文件config中添加
Host Jupyter-ServerHostName <IP>ForwardX11 yesForwardX11Trusted yesForwardAgent yesUser <Username>
2. 在远程服务器的.sshd_config中把X11forward的开关打开为yes
3. 在home文件夹中更改.bashrc,加入以下内容
export DISPLAY='localhost:10.0'
4. 运行以下命令,并检查echo的输出是否localhost:10.0
source ./bashrc
echo $DISPLAY
5. 在本地vscode中连接到刚刚创建的jupyter-server,测试是否能显示图像
import matplotlib.pyplot as plt
from plyfile import *
from mpl_toolkits.mplot3d import Axes3Dplydata = PlyData.read(datadir + datapath)xlist = plydata['vertex']['x']
ylist = plydata['vertex']['y']
zlist = plydata['vertex']['z']fig = plt.figure()
ax = Axes3D(fig,auto_add_to_figure=False)
fig.add_axes(ax)
ax.scatter(xlist, ylist, zlist)
plt.show()