我最近从 synaptic 安装了 Python 和 IDLE。但是,当我测试 Tkinter 时,出现以下错误:
import Tkinter
Tkinter._test()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 3790, in _test
root = Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1767, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: Can't find a usable tk.tcl in the following directories:
/usr/local/src/tcl8.6.1/library/tk8.6 /usr/local/src/tcl8.6.1/tk8.6 /usr/lib/tk8.6 /usr/local/lib/tk8.6 /lib/tk8.6 /usr/library
This probably means that tk wasn't installed properly.
但是,我已经使用以下命令安装了 tk:
sudo apt-get install tk8.6 tk-dev
我不知道发生了什么。为了安装模块环境,我tcl8.6.1
从源代码编译了/usr/local/src/tcl8.6.1
。这可能是问题所在吗?
谢谢
最好的,
汤姆