【发布时间】:2019-07-18 11:45:52
【问题描述】:
我用 Tkinter 成功创建了 GUI python2.7 程序,没有错误。现在我想在 anaconda 环境中使用 pyinstaller 制作它的可执行文件(我使用的是 windows 10)。
使用这个命令
pyinstaller --onefile main.py 我可以在 dist 文件夹中成功创建 exe 文件。但是当我尝试运行exe文件时,它显示错误:
Traceback (most recent call last):
File "main.py", line 333, in <module>
File "main.py", line 90, in __init__
File "lib-tk\ttk.py", line 715, in current
_tkinter.TclError: Index 0 out of range
[22668] Failed to execute script main
问题与 tkinter 有关吗?我在这里尝试了解决方案:Problems with Pyinstaller with tkinter app on python 3.5 和这里:How to make pyinstaller import the ttk theme?。但还是一样的错误
【问题讨论】:
-
我会使用 cx_freeze 来编译一个 exe。我用那个库而不是 pyinstaller 做了一些项目。
-
为此使用 Py-Auto-Gui
标签: python tkinter pyinstaller