繁体   English   中英

pyinstaller 生成的 exe 无法按预期工作

[英]exe generated by pyinstaller doesn't work as expected

我使用 pyinstaller 将我的 py 转换为 exe。 它包含一个由 tkinter 编写的 UI。

pyinstaller -F my_tool.py

exe在我自己的电脑上运行正常(1-2分钟出现UI),但是当我发送给别人时,显示UI需要很长时间(>15分钟)。

我不知道为什么会发生这种情况以及如何使 exe 在其他计算机中快速响应。 有谁知道如何处理它?

- -编辑 - -

我在日志中发现了一些警告,我想知道这些警告是否会影响 exe:

62194 WARNING: Hidden import "importlib_resources.trees" not found!
62446 WARNING: Conda distribution 'numpy', dependency of 'numpy', was not found. If you installed this distribution with pip then you may ignore this warning.
76721 WARNING: Hidden import "pkg_resources.py2_warn" not found!
76721 WARNING: Hidden import "pkg_resources.markers" not found!

我检查了环境中的包,我已经安装了 numpy、importlib_resources。 对于 pkg_resources,pip 不会引发匹配分布错误。

我还发现output文件的后缀是'.exe.notanexecutable',而不是'.exe'。

125205 INFO: Copying bootloader EXE to C:\Users\XinDong\Documents\tool\dist\tool.exe.notanexecutable
...
125615 INFO: Updating manifest in C:\Users\XinDong\Documents\AP_TST\tool\dist\tool.exe.notanexecutable

卸载你的pyinstaller,然后从以下链接安装它https://github.com/pyinstaller/pyinstaller/tarball/develop很可能,问题解决

Yout 可以使用 auto-py-to-exe。 这对我来说很好(也使用 pyinstaller)。 它可能会添加一些可以解决您的问题的参数(不是舒尔)。

了解您的代码使用哪些模块以及它是否创建了数据库等会很有趣。

也许另一台电脑只是缺少硬件。

PS:对不起,使用答案。 我还没有评论的声誉。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM