使用tkcalendar启动exe时出现错误消息

时间:2020-03-23 06:09:43

标签: python tkinter tkcalendar

from tkcalendar DateEntry

from tkinter import *
root=Tk()

root.title("Date picker")
d=DateEntry(root)
d.pack()


root.mainloop()

当我尝试打开其可执行文件时,启动“ enter image description here”时出现错误消息,我的脚本名为dd (我使用Auto_py_to_exe转换了我的python文件)

1 个答案:

答案 0 :(得分:3)

我发现了错误并与您的脚本有关。

  1. 您不导入DateEntry
from tkcalendar import DateEntry

from tkinter import *
root=Tk()

root.title("Date picker")
d=DateEntry(root)
d.pack()


root.mainloop()
  1. 将脚本转换为exe时,可以看到缺少模块。如果要检查缺少的模块,请在命令提示符下运行它。
pyinstaller -F dd.py

它将显示您缺少“ babel.numbers”模块。

现在要解决此问题。 使用下面的onliner自动导入模块,并将.py脚本转换为.exe。

pyinstaller.exe --hidden-import babel.numbers dd.py

相关问题