Mac OS X:_tkinter.TclError:无显示名称和$ DISPLAY环境变量 [英] Mac OS X: _tkinter.TclError: no display name and no $DISPLAY environment variable

查看:181
本文介绍了Mac OS X:_tkinter.TclError:无显示名称和$ DISPLAY环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如我所说,我已经从Macports安装了Python 3.3.

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?

让人想起这个问题:区别在于我没有收到任何错误消息,并且正在使用3.3

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

更新:

现在,我尝试使用macports select将Py3.3设置为主版本.然后,我尝试从控制台打开IDLE,并收到以下错误消息:

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

推荐答案

使用macport,安装py33-tkinter

Using macports, install py33-tkinter

sudo port install py33-tkinter

确保还安装了X11或Xquartz.

Make sure you have X11 or Xquartz installed too.

这篇关于Mac OS X:_tkinter.TclError:无显示名称和$ DISPLAY环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆