升级到OS X 10.9后出现Tkinter错误

2024-05-13 13:35:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个在OSX10.7.5中运行良好的Tkinter应用程序。最近,当我升级到10.9.2时,它停止运行,抛出以下错误:

Traceback (most recent call last):
 File "roiTracker.py", line 5127, in <module>
   startTracker(filename=filename)
 File "roiTracker.py", line 5111, in startTracker
   tk = TK.Tk()
 File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1745, in _init_
   self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

Tkinter和python版本:

^{pr2}$

$DISPLAY变量的内容:

user:Desktop user$ echo $DISPLAY

user:Desktop user$

根据this similar-sounding problem,我试过了

launchctl load -w /Library/LaunchAgents/org.macosforge.xquartz.startx.plist

得到了

Couldn't stat("/Library/LaunchAgents/org.macosforge.xquartz.startx.plist"): No such file or directory
nothing found to load

不知道这是不是幼稚-我对窗口后端的工作原理一无所知。在

我在本地运行所有这些命令。在

谢谢你的帮助!在


Tags: noinpytkinterlibdisplaylinelibrary