问题描述
我使用 --onefile 参数使用 Pyinstaller 创建了一个单文件 python 应用程序.一切都按预期工作,但在我的机器上启动时间约为 10 秒.问题是在Pyinstaller包的文件解压过程中没有视觉反馈,所以你不知道应用程序是否正在启动,甚至你是否真的点击了图标.如果机器很慢,这个问题会变得更糟(在我用一台非常旧的机器测试时,我需要将近 20 秒才能看到我的应用程序的第一次登录)有没有办法在 Pyinstaller 引导序列期间创建一些闪屏或视觉反馈(如解包器上的进度条)?
I create a single file python application with Pyinstaller using --onefile parameters.Everything work as expected but the startup time is around 10 seconds on my machine. The problems is that during the file unpacking process of Pyinstaller package there are no visual feedback, so you don't know if the application is starting or even if you really clicked the icon. This problem became worse if the machine is slow (on my test with a very old machine i need almost 20 seconds to see the first login of my application)There is a way to create some splash screen or visual feedback (like a progress bar as on unpackers) during the Pyinstaller bootstrap sequence?
请注意问题是关于Pyinstaller解包过程BEFORE真正的应用程序将不会被已经有自己的启动画面的应用程序本身执行
Please note the question is about Pyinstaller unpacking process BEFORE the real application will be executed not by the application itself that already has is own splash screen
谢谢
19.01.2018 - UPDATE1我的应用程序是完整的 GUI,所以我不想在解包过程中使用控制台作为视觉反馈".
19.01.2018 - UPDATE1My application is FULL GUI so i prefer to not use the console as "visual feedback" during the unpacking process.
推荐答案
我自己一直在与这个问题作斗争.不幸的是,除了使用丑陋的控制台之外,没有可行的解决方案(完全同意).
I have been battling with this problem myself. Unfortunately, there is no feasible solution to the problem other than using the ugly console (completely agree there).
问题源于这样一个事实:在 PyInstaller 将所有文件解压到临时目录之前,不会运行任何脚本.根据我的研究,无法使用 PyInstaller 中当前可用的选项来更改此功能.如果 PyInstaller 背后的社区能够将此作为模块的标准功能,那就太好了,但在那之前我们可能不得不探索其他安装程序选项.
The problem stems from the fact that until PyInstaller unpacks all the files into a temp dir, no scripts will be run. From my research, there is no way to alter this functionality using currently available options within PyInstaller. It would be nice if the community behind PyInstaller would make this a standard feature of the module, but until then we may have to explore other installer options.
编程愉快!
这篇关于Pyinstaller 在文件提取期间添加启动画面或视觉反馈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!