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

寵の児 提交于 2019-12-04 04:40:46

问题


As I said, I have installed Python 3.3 from Macports.

Now when I do a spotlight search for Idle

Idle -- Python 3.3

shows up. However when I try to click it, nothing happens. No error is shown or anything- it plain does not start.

What do you think might be wrong?

It is reminiscent of this question: Python 3.0 - Idle wont open. It just bounces in the dock

The difference is that I get no error messages and am using 3.3


Update:

Now I tried setting Py3.3 as my main version using macports select. Then I tried opening IDLE from the console and got the following error message:

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

回答1:


Using macports, install py33-tkinter

sudo port install py33-tkinter

Edit: Make sure you have X11 or Xquartz installed too.




回答2:


I had same problem with python32 port on my OS X Lion 10.7.5 and got fixed simply by installing py32-tkinter port. I checked and already has installed X11. Thanks.



来源:https://stackoverflow.com/questions/13286324/mac-os-x-tkinter-tclerror-no-display-name-and-no-display-environment-variabl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!