1

Idk why I got this errors when trying to open IDLE in WSL terminal

Traceback (most recent call last):
  File "/usr/bin/idle", line 5, in <module>
    main()
  File "/usr/lib/python3.6/idlelib/pyshell.py", line 1485, in main
    root = Tk(className="Idle")
  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
Terry Jan Reedy
  • 18,414
  • 3
  • 40
  • 52
Hoai Dang
  • 11
  • 4
  • See https://stackoverflow.com/questions/37604289/tkinter-tclerror-no-display-name-and-no-display-environment-variable – Tin Nguyen Mar 31 '20 at 09:48

2 Answers2

1

Install XMing on your machine. Make sure it is running before you start WSL.

In WSL, change your .profile. At the bottom append

export DISPLAY=:0.0

Close your WSL window and reopen.

You can then run any X application including idle.

cup
  • 7,589
  • 4
  • 19
  • 42
0

IDLE is an application with GUI that requires X11 or Wayland to be installed on the system.
The "no $DISPLAY environment variable" error means that the system has no displays excluding terminals.
"no display name" means that you did not provide a display to display IDLE on.

Muskovets
  • 449
  • 8
  • 16