version conflict for package "Tk": have 8.5.2, need exactly 8.5.15

peech picture peech · Nov 3, 2014 · Viewed 9.8k times · Source

I am trying to compile a program (python2.7) but no matter what I do I keep getting this error:

C:/Python27/tcl/tk8.5/tk.tcl: version conflict for package "Tk": have 8.5.2, need exactly 8.5.15
version conflict for package "Tk": have 8.5.2, need exactly 8.5.15
while executing
"package require -exact Tk  8.5.15"
    (file "C:/Python27/tcl/tk8.5/tk.tcl" line 18)
    invoked from within
"source C:/Python27/tcl/tk8.5/tk.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 [list source $file]"

This probably means that tk wasn't installed properly.

Can someone please explain to me what's the problem here?

Answer

yulong zhao picture yulong zhao · Mar 14, 2016

step 1: open C:\Python27\tcl\tcl8.5\init.tcl

if {[info commands package] == ""} {
    error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]"
}
package require -exact Tcl 8.5.15 

8.5.15 changed to 8.5.2

step 2: open C:\Python27\tcl\tk8.5\tk.tcl

package require Tcl 8.5 ;# Guard against [source] in an 8.4- interp before
            ;# using 8.5 [package] features.
# Insist on running with compatible version of Tcl
package require Tcl 8.5.0
# Verify that we have Tk binary and script components from the same release
package require -exact Tk  8.5.15

8.5.15 changed to 8.5.2