V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
thebeatlesguru
V2EX  ›  Python

求助:Tcl wasn't installed properly

  •  
  •   thebeatlesguru · 2013-04-23 16:08:40 +08:00 · 7187 次点击
    这是一个创建于 4263 天前的主题,其中的信息可能已经有所发展或是发生改变。
    代码如下:
    #!/usr/bin/python
    #filename : psctk.py

    from Tkinter import *

    root = Tk()
    w = Label(root,text = "hello, world!")

    w.pack()

    root.mainloop()

    运行的时候报错所TCL没有安装对:
    Traceback (most recent call last):
    File "psctk.py", line 6, in <module>
    root = Tk()
    File "C:\Python27\lib\lib-tk\Tkinter.py", line 1745, in __
    self.tk = _tkinter.create(screenName, baseName, classNam
    objects, useTk, sync, use)
    _tkinter.TclError: Can't find a usable init.tcl in the follo
    {C:\Python27\tcl\tcl8.5} C:/Python27/lib/tcl8.5 C:/lib/t
    C:/library C:/library C:/tcl8.5.9/library C:/tcl8.5.9/librar

    C:/Python27/tcl/tcl8.5/init.tcl: version conflict for packag
    need exactly 8.5.2
    version conflict for package "Tcl": have 8.5.9, need exactly
    while executing
    "package require -exact Tcl 8.5.2"
    (file "C:/Python27/tcl/tcl8.5/init.tcl" line 20)
    invoked from within
    "source C:/Python27/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.

    不知道如何调试,请大侠不吝赐教。
    1 条回复    1970-01-01 08:00:00 +08:00
    ThunderEX
        1
    ThunderEX  
       2013-04-23 16:38:25 +08:00
    我之前遇到过在virtualenv里面跑tkinker,但tkinker的lib没有放到virtualenv里面,就会报这个错……
    把c:\python27\tcl直接拷进virtualenv就OK了。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3443 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 04:51 · PVG 12:51 · LAX 20:51 · JFK 23:51
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.