[英]Mac OS X: _tkinter.TclError: no display name and no $DISPLAY environment variable
As I said, I have installed Python 3.3 from Macports.正如我所说,我已经从 Macports 安装了 Python 3.3。
Now when I do a spotlight search for Idle现在当我对 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.这让人想起这个问题: Python 3.0 - Idle won't open。 It just bounces in the dock
它只是在码头上弹跳
The difference is that I get no error messages and am using 3.3不同之处在于我没有收到错误消息并且正在使用 3.3
Update:更新:
Now I tried setting Py3.3 as my main version using macports select.现在我尝试使用 macports select 将 Py3.3 设置为我的主要版本。 Then I tried opening IDLE from the console and got the following error message:
然后我尝试从控制台打开 IDLE 并收到以下错误消息:
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
Using macports, install py33-tkinter
使用 macports,安装
py33-tkinter
sudo port install py33-tkinter
Edit: Make sure you have X11 or Xquartz installed too.编辑:确保您也安装了 X11 或 Xquartz。
I had same problem with python32 port on my OS X Lion 10.7.5 and got fixed simply by installing py32-tkinter port.我的 OS X Lion 10.7.5 上的 python32 端口有同样的问题,只需安装 py32-tkinter 端口即可解决。 I checked and already has installed X11.
我检查并已经安装了X11。 Thanks.
谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.