Tkinter Cxfreeze 错误
我正在尝试用我在Linux中开发的python在Windows中制作一个exe文件。该程序在 Windows 下的 python 中独立运行,当我使用 cxfreeze 时,它会完成并生成 exe。然而,当我运行它时,我得到:
C:\projects\0802001S\dist>listen.exe
Traceback (most recent call last):
File "C:\Python26\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27
, in <module>
exec code in m.__dict__
File "./listen.py", line 425, in <module>
File "C:\Python26\lib\lib-tk\Tkinter.py", line 1643, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, want
objects, useTk, sync, use)
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
C:/projects/0802001S/lib/tcl8.5 C:/projects/0802001S/lib/tcl
8.5 C:/projects/lib/tcl8.5 C:/projects/0802001S/library C:/projects/libr
ary C:/projects/tcl8.5.9/library C:/tcl8.5.9/library
这可能意味着 Tcl 没有正确安装。
因此,我随后在 C: 驱动器的 Python26 目录中查找 init.tcl,并将其复制到它建议的目录之一。然后给了我这个错误:
C:\projects\0802001S\dist>listen.exe
Traceback (most recent call last):
File "C:\Python26\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27
, in <module>
exec code in m.__dict__
File "./listen.py", line 425, in <module>
File "C:\Python26\lib\lib-tk\Tkinter.py", line 1643, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, want
objects, useTk, sync, use)
_tkinter.TclError: invalid command name "tcl_findLibrary"
我似乎在这一点上碰壁了,记起了为什么我首先切换到Linux。
更熟悉 Windows 的人有什么建议吗?
I'm trying to make an exe in Windows out of python I developed in Linux. The program works on it's own in python under Windows, and when I use cxfreeze it completes and makes the exe. However when I run it I get:
C:\projects\0802001S\dist>listen.exe
Traceback (most recent call last):
File "C:\Python26\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27
, in <module>
exec code in m.__dict__
File "./listen.py", line 425, in <module>
File "C:\Python26\lib\lib-tk\Tkinter.py", line 1643, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, want
objects, useTk, sync, use)
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
C:/projects/0802001S/lib/tcl8.5 C:/projects/0802001S/lib/tcl
8.5 C:/projects/lib/tcl8.5 C:/projects/0802001S/library C:/projects/libr
ary C:/projects/tcl8.5.9/library C:/tcl8.5.9/library
This probably means that Tcl wasn't installed properly.
So, I then looked for init.tcl in my Python26 directory in my C: drive, and copied it to one of the directories it suggested. Which then gave me this error:
C:\projects\0802001S\dist>listen.exe
Traceback (most recent call last):
File "C:\Python26\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27
, in <module>
exec code in m.__dict__
File "./listen.py", line 425, in <module>
File "C:\Python26\lib\lib-tk\Tkinter.py", line 1643, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, want
objects, useTk, sync, use)
_tkinter.TclError: invalid command name "tcl_findLibrary"
I seem to have hit a wall at this point and remember why I switched to Linux in the first place.
Any suggestions from someone who's more familiar with Windows?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚遇到类似的事情。到目前为止,我得出的结论是将 tcl8.5 和 tk8.5 复制到运行listen.exe 的目录(dist/build dir)中。
我也在 cx_freeze 邮件列表中,其中提到该钩子可能只在 Unix 上运行,因为截至当前版本 (12/29/10),它从未在 Windows 中进行过测试
I just ran into something similar. The conclusion I have so far is to copy both tcl8.5 and tk8.5 into the directory where you're running listen.exe (dist/build dir).
I was also on the cx_freeze mailinglist and there was mentioning about the hook possibly only running on Unix since it was never tested in Windows as of this current build (12/29/10)