version conflict for package “Tk”: have 8.5.2, nee

2019-02-17 04:53发布

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?

2条回答
一纸荒年 Trace。
2楼-- · 2019-02-17 05:19

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

查看更多
Explosion°爆炸
3楼-- · 2019-02-17 05:26

Tk comes in (conceptually) two pieces:

  1. the dynamic library file that implements the views
  2. the script library file(s) that implements the default controllers.

These must be exactly matched to each other (it's the only way in which they are warranted to work correctly). By default, the Tk DLL includes the path where it can find its scripts, but it can be overridden by environment variables; that mechanism is mainly intended to support pre-installation testing, though sometimes it gets used rather more than it really ought.

You appear to have configured things so that you have one version of the DLL (8.5.2) whereas a different version of the scripts (8.5.15). This could be because you've linked against the wrong version of the DLL, or because you have an environment variable (TK_LIBRARY) set to point to the wrong installation. Which it is is a little hard to tell from the error message: all it really says is that there is a version mismatch.

查看更多
登录 后发表回答