MacOS – Macports Python IDLE 3.4 not opening

macosmacportspythonterminal

Per earlier articles (especially Python IDLE from MacPorts can't start), I've attempted to get my Python version 3.4 to work from the Macports IDLE.app but to no avail. I've already tried the usual double clicking as well as running through the terminal, and I have the appropriate py34-tkinter port installed.

Whenever I try to run it (either by double-clicking or by running $ idle3.4 from the terminal) the icon bounces in the dock for a split second and then disappears. Running from the terminal gets me:

Traceback (most recent call last):
  File "/opt/local/bin/idle3.4", line 5, in <module>
main()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/idlelib/PyShell.py", line 1532, in main
root = Tk(className="Idle")
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/__init__.py", line 1856, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable`

I'm trying to set up my system to run NLTK if that helps, and I have OS X El Capitan. I'm new to posting so I apologize if this is out of place or I've left out relevant details.

Thanks, in advance, for the help!

Best Answer

Macports version of IDLE needs X11 to be installed on the computer

Check you've X11 installed and if not download and install it here - https://www.xquartz.org/

If installed check it is version 2.7.9 .. if not update it using the link above

If it is installed and up to date and IDLE still gives the above error run the following command in a terminal window to get X11 to autolaunch launchctl load -w /Library/LaunchAgents/org.macosforge.xquartz.startx.plist