简体   繁体   English

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

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

I use pyinstaller to convert my py to exe.我使用 pyinstaller 将我的 py 转换为 exe。 It contains a UI written by tkinter.它包含一个由 tkinter 编写的 UI。

pyinstaller -F my_tool.py

The exe runs normally on my own computer (UI appears in 1-2 min), but when I send it to others, it takes very long time (>15min) to display the UI. exe在我自己的电脑上运行正常(1-2分钟出现UI),但是当我发送给别人时,显示UI需要很长时间(>15分钟)。

I have no idea of why this happens and how to make the exe respond quickly in other computers.我不知道为什么会发生这种情况以及如何使 exe 在其他计算机中快速响应。 Does anyone know how to deal with it?有谁知道如何处理它?

---Edit--- - -编辑 - -

I found some warnings in the log and I'm wondering whether the warnings impact the 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!

I checked the packages in the env and I have installed numpy, importlib_resources.我检查了环境中的包,我已经安装了 numpy、importlib_resources。 For pkg_resources, pip throws no matching distribution error.对于 pkg_resources,pip 不会引发匹配分布错误。

I also found that the suffix of the output file is '.exe.notanexecutable', not '.exe'.我还发现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

Uninstall your pyinstaller, then install it from the following link https://github.com/pyinstaller/pyinstaller/tarball/develop most likely, the problem is solved卸载你的pyinstaller,然后从以下链接安装它https://github.com/pyinstaller/pyinstaller/tarball/develop很可能,问题解决

Yout could use auto-py-to-exe. Yout 可以使用 auto-py-to-exe。 Thats works for me fine(uses pyinstaller as well).这对我来说很好(也使用 pyinstaller)。 It may add a few parameters that could fix your problem(not shure).它可能会添加一些可以解决您的问题的参数(不是舒尔)。

It would be interesting to know what modules your code uses and if it creates a database or so.了解您的代码使用哪些模块以及它是否创建了数据库等会很有趣。

Maybe the other pc is just lackin hardware.也许另一台电脑只是缺少硬件。

PS: Sorry, for using answer. PS:对不起,使用答案。 I do not have the reputation for comments yet.我还没有评论的声誉。

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

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