简体   繁体   English

Python 可执行文件耗时过多

[英]Python Executable taking too much time

I have a python code to search in pdf documents.我有一个 python 代码可以在 pdf 文档中搜索。 When I run the.py file, it executes fine.当我运行 .py 文件时,它执行得很好。 However, i have made an executable file with pyinstaller.但是,我用 pyinstaller 制作了一个可执行文件。 this exe file is taking too long to open - almost 10 minutes.这个 exe 文件打开时间太长 - 差不多 10 分钟。 What could be the reason?可能是什么原因?

10 minutes is very very long. 10分钟非常非常长。 But it you build a single executable with pyinstaller, it will uncompress itself into a temp folder everytime it starts.但是如果您使用 pyinstaller 构建单个可执行文件,它会在每次启动时将自身解压缩到一个临时文件夹中。 That folder will contain the required libraries a modified version of the Python interpretor and your own code in pre-compiled form.该文件夹将包含所需的库、Python 解释器的修改版本和您自己的预编译形式的代码。 If you use a slow disk unit or have little space on it, it will indeed take time.如果您使用速度较慢的磁盘单元或上面的空间很小,则确实需要时间。

A possible way to speed up the start time is to have pyinstaller build a folder.加快启动时间的一种可能方法是让 pyinstaller 构建一个文件夹。 This will save the initial uncompressing time.这将节省初始解压缩时间。

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

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