简体   繁体   English

Mac OS X: _tkinter.TclError: 没有显示名称和 $DISPLAY 环境变量

[英]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.

相关问题 DietPI:_tkinter.TclError:没有显示名称,也没有 $DISPLAY 环境变量 - DietPI: _tkinter.TclError: no display name and no $DISPLAY environment variable Ubuntu:_tkinter.TclError:没有显示名称,也没有 $DISPLAY 环境变量 - Ubuntu: _tkinter.TclError: no display name and no $DISPLAY environment variable tkinter.TclError:没有显示名称,没有$ DISPLAY环境变量python - tkinter.TclError: no display name and no $DISPLAY environment variable python Tkinter.tclerror:没有显示名称和没有 $display 环境变量 Ubuntu 20.04 - Tkinter.tclerror: no display name and no $display environment variable Ubuntu 20.04 _tkinter.TclError: 没有显示名称和 $DISPLAY 环境变量 - _tkinter.TclError: no display name and no $DISPLAY environment variable Putty:_tkinter.TclError:没有显示名称,也没有diplay环境变量 - Putty: _tkinter.TclError: no display name and no diplay environment variable tkinter,python和seaborn的问题:_tkinter.TclError:没有显示名称,没有$ DISPLAY环境变量 - Issue with tkinter, python and seaborn: _tkinter.TclError: no display name and no $DISPLAY environment variable Matplotlib后端问题_tkinter.TclError:没有显示名称,没有$ DISPLAY环境变量 - Matplotlib Backend issue _tkinter.TclError: no display name and no $DISPLAY environment variable 在 Python 中实例化画布:tkinter.TclError:无显示名称且无 $DISPLAY 环境变量 - Instantiating a Canvas in Python : tkinter.TclError: no display name and no $DISPLAY environment variable 无法使用pyplot,pandas绘制图表:_tkinter.TclError:无显示名称和$ DISPLAY环境变量 - Unable to Plot graph using pyplot, pandas: _tkinter.TclError: no display name and no $DISPLAY environment variable
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM