_tkinter.TclError: no display name and no $DISPLAY environment variable

Windows下使用putty远程连接到服务器上,需要显示图形界面时比如show()时会出现此error.

1.在服务器端安装xterm和xauth:

yum install xterm

yum install xauth

2.在服务器端vi /etc/ssh/sshd_config,添加一行:

X11Forwarding yes

3.重启sshd

systemctl restart sshd.service  --重启

systemctl status sshd.service   --查看状态

4.在Windows端下载Xming+Putty

5.安装并开启Xming后,打开Putty进行配置:


后面的X display location不用填。

登陆后,运行xterm代表成功。


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容