我刚刚为 python 安装了 graphics.py。但是当我尝试运行以下代码时:
from graphics import *
def main():
win = GraphWin("My Circle", 100, 100)
c = Circle(Point(50,50), 10)
c.draw(win)
win.getMouse() # Pause to view result
win.close() # Close window when done
main()
我的翻译给了我这个奇怪的信息:
Traceback (most recent call last):
File "F:\CS 101\Python\projects\packer.py", line 8, in <module>
from graphics import *
File "F:\CS 101\Python\lib\site-packages\graphics.py", line 168, in <module>
_root = tk.Tk()
File "F:\CS 101\Python\lib\tkinter\__init__.py", line 1674, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
{F:\CS 101\Python\tcl\tcl8.5.9} {F:/CS 101/Python/tcl/tcl8.5} {F:/CS 101/Python/lib/tcl8.5} {F:/CS 101/lib/tcl8.5} F:/lib/tcl8.5 {F:/CS 101/library} F:/library F:/tcl8.5.2/library F:/tcl8.5.2/library
F:/CS 101/Python/tcl/tcl8.5/init.tcl: version conflict for package "Tcl": have 8.5.2, need exactly 8.5.9
version conflict for package "Tcl": have 8.5.2, need exactly 8.5.9
while executing
"package require -exact Tcl 8.5.9"
(file "F:/CS 101/Python/tcl/tcl8.5/init.tcl" line 20)
invoked from within
"source {F:/CS 101/Python/tcl/tcl8.5/init.tcl}"
("uplevel" body line 1)
invoked from within
"uplevel #0 [list source $tclfile]"
这可能意味着 Tcl 没有正确安装。
这是什么意思?我能做些什么?
PS:我正在使用 Eclipse (PyDev) 进行编码。