我有一个在OS X 10.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版本:
user:Desktop user$ python
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
>>> Tkinter.__version__
'$Revision: 81008 $'
>>> exit()
$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
不确定这是否天真 - 我对窗口后端的工作方式一无所知。
我在本地运行所有这些命令。
感谢您的帮助!