我刚刚在我的OSX 10.8.4上安装了Tkinter,并在Anaconda上安装了Python 2.7.5。 我现在可以用
导入Tkinterimport Tkinter
或
from Tkinter import *
它似乎工作(没有错误信息)。
现在我尝试创建一个显示器。我这样做:
window = Tk()
此时我得到:
TclError Traceback (most recent call last)
<ipython-input-5-711542866473> in <module>()
----> 1 fenetre = Tk()
/Users/geoffroysarrazin/anaconda/lib/python2.7/lib-tk/Tkinter.pyc in __init__(self, screenName, baseName, className, useTk, sync, use)
1743 baseName = baseName + ext
1744 interactive = 0
-> 1745 self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
1746 if useTk:
1747 self._loadtk()
TclError: Can't find a usable init.tcl in the following directories:
/opt/anaconda1anaconda2anaconda3/lib/tcl8.5
/Users/geoffroysarrazin/anaconda/python.app/Contents/lib/tcl8.5
/Users/geoffroysarrazin/anaconda/python.app/lib/tcl8.5
/Users/geoffroysarrazin/anaconda/python.app/Contents/library
/Users/geoffroysarrazin/anaconda/python.app/library
/Users/geoffroysarrazin/anaconda/python.app/tcl8.5.13/library
/Users/geoffroysarrazin/anaconda/tcl8.5.13/library
This probably means that Tcl wasn't installed properly.
我尝试安装ActiveTcl8.5.14.0但没有变化。我甚至不知道这个目录
/opt/anaconda1anaconda2anaconda3/lib/tcl8.5
实际上是......