我正在尝试使用 tkcalendar 在 Windows 上使用 pyinstaller 安装 python 应用程序。应用程序正在运行,但 tkcalendar.Calendar 不运行。
当我在没有安装的情况下运行应用程序时,一切正常,但如果我这样做,日历小部件不会出现。
我认为 pyinstaller 看到了这个模块,但他对 tkcalendar 正在使用的模块有问题。
我尝试使用 --path=/.../python/Lib/site-packages 运行 pyinstaller 但这不起作用。将模块文件复制到应用程序目录也没有帮助。
问题并非来自tkcalendar
但事实上 PyInstaller 不检测二级导入。 tkcalendar 的文档中解释了解决此问题的方法HowTos https://tkcalendar.readthedocs.io/en/stable/howtos.html#pyinstaller部分:
当使用 PyInstaller 捆绑应用程序时,有一个issue https://github.com/j4321/tkcalendar/issues/32与
检测 tkcalendar 的 babel 依赖性。这可以通过以下方式修复
使用--hidden-import
option:
$ pyinstaller --hidden-import babel.numbers myscript.py
或通过编辑.spec file:
hiddenimports=["babel.numbers"]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)