Python tcl is not installed properly

psiovana picture psiovana · May 14, 2012 · Viewed 40k times · Source

I just installed graphics.py for python. But when I tried to run the following code:

    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()

my interpreter gave me this strange information:

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]"

This probably means that Tcl wasn't installed properly.

What does it mean? What can I do?

PS: I am using Eclipse (PyDev) for coding.

Answer

shucun GUO picture shucun GUO · Oct 28, 2016

I sloved by modifying my activate script:

set "TCL_LIBRARY=D:\Program Files (x86)\Python3.5\tcl\tcl8.6"
set "TK_LIBRARY=D:\Program Files (x86)\Python3.5\tcl\tcl8.6"