我刚刚在我的 OSX 10.8.4 上安装了 Tkinter,并安装了 Python 2.7.5 和 Anaconda。我现在可以导入 Tkinter
import 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
其实是……