问题描述
我有一个使用 Tkinter 的基本 Python 脚本.
I have a basic Python script which uses Tkinter.
from Tkinter import Tk
from tkFileDialog import askdirectory
Tk().withdraw()
print askdirectory()
使用 PyInstaller 编译脚本后,我尝试在未安装 Python 的 Windows 7(64 位)计算机上运行我的程序.
After compiling my script with PyInstaller, I tried to run my program on Windows 7 (64-bit) computer which didn't have Python installed.
它引发了这个错误:
Can't find a usable init.tcl in the following directories: [list of directories]
This probably means that Tcl wasn't installed properly
为什么我的脚本用 PyInstaller 编译后找不到 init.tcl
?
Why does my script fail to find init.tcl
after compiling with PyInstaller?
推荐答案
这是 Windows 7 64 位计算机上 PyInstaller 和 Tkinter 的已知问题.PyInstaller 的 GitHub 存储库中有一个问题报告.
This is a known issue with PyInstaller and Tkinter on Windows 7 64-bit machines. There is an issue report in the GitHub repository of PyInstaller.
在底部,这个问题一直引用自另一个问题,即这个问题 表示降级到 PyInstaller 3.1.0 有助于其他人解决问题.
All the way at the bottom this issue was referenced from another issue, namely this one which says that downgrading to PyInstaller 3.1.0 helps other people solve the issue.
pip install pyinstaller==3.1.0
我自己已经能够使用虚拟机确认这一点.
I myself have been able to confirm this using a Virtual Machine.
这篇关于PyInstaller 在 Windows 7 上失败:“找不到可用的 init.tcl";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!