我正在尝试通过ssh客户端和xming从树莓派运行Tkinter脚本。通过shh登录到pi后,可以使用以下命令:
gksudo python3 home/pi/PythonScripts/TkinterTest.py
这是我的电脑上给出的错误:
(gksudo:2700): Gtk-WARNING **: cannot open display:
并且在运行相同软件的笔记本电脑上出现了另一个错误:
(gksudo:3227): GLib-CRITICAL **: g_str_has_prefix: assertion 'str != NULL' failed
我尝试使用以下命令更改显示:
export DISPLAY=:0.0
但这对输出没有影响。
最佳答案
/etc/ssh/sshd_config
中进行检查:X11Forwarding yes
ssh -X username@<raspberry>
(X11转发的-X标志)(su) python /path/to/script.py
有时,当您尝试通过sudo运行程序时,可能会出现一些错误,您需要检查.Xauthority文件的权限
关于python-3.x - 通过Shh和Xming的Raspberry Pi Tkinter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29593245/