因此,我试图在Windows 10上使用来自Ubuntu命令行的tkinter运行python GUI,并获得以下错误:
brandon@DESKTOP-V5LTF5T:~$ python3 MainApp.py
Traceback (most recent call last):
File "MainApp.py", line 14, in <module>
root = tk.Tk()
File "/usr/lib/python3.6/tkinter/__init__.py", line 2023, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable如果您正在使用matplotlib库,那么请使用以下问题:_tkinter.TclError: no display name and no $DISPLAY environment variable
但是,这个问题只适用于使用tkinter库的人。
发布于 2020-07-03 15:59:10
除非下载外部软件,否则不能在bash终端中运行active GUI。下面是我如何解决这个问题的教程:http://pjdecarlo.com/2016/06/xming-bash-on-ubuntu-on-windows-x11-window-system-running-from-windows-10-subsystem-for-linux.html
的右下角。
brandon@DESKTOP-V5LTF5T:~$ export DISPLAY=localhost:0.0,这将显示变量设置为新安装的xming xerver.的本地主机
现在运行您的GUI!brandon@DESKTOP-V5LTF5T:~$ python3 MainApp.py!
https://stackoverflow.com/questions/62718967
复制相似问题