pyinstaller一个文件包崩溃时要留下临时文件,如何自动清洁这些文件?
我正在使用pyinstaller创建一个使用命令行的文件可执行文件。像所有“一个文件” Exeutables一样,它每次打开时都会在OS的一个临时文件夹中提取二进制文件/依赖项。通常,它在正确关闭应用程序后清洁了这些内容,但是当我关闭命令行(或应用程序崩溃时)时,它将所有提取的临时文件留在该临时文件夹中。并且它每次打开应用程序时都会创建新的temp文件夹(并带有名称“ _meixxxxxx”),因此,如果未手动清洁,旧的崩溃的临时温度会留在那里。 我使用- Runtime-tmpdir
参数来指定一个单独的临时文件夹,但那里也发生了同样的情况。有什么解决方法吗?
I am using pyinstaller to create one file executable with command line. Like all "one file" exeutables, it extracts binaries/dependencies in one temporary folder of OS whenever opened. It generally clean those after closing the application properly but when I close the command line (or when the app crashes) then it leaves all those extracted temp files behind in that temp folder. And it creates new temp folder (with name "_MEIxxxxxx") every time I open the app, so the old crashed temp stays there if not cleaned manually.
I used the --runtime-tmpdir
parameter to specify one separate temp folder, but the same is happening there also. Any fix to this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个问题从很长一段时间内就存在,但终于在新的5.3版本中修复了。
因此,对于那些面临此问题的人,只需将Pyinstaller更新到最新版本(5.3+)。
现在,如果我们关闭“父控制台”窗口或终止任务管理器中的进程,或者即使我们关闭系统,则“ _meixxxxxx”文件夹将被删除。
您可以查看完整的changelog 在这里
This issue was there from a very long time, but it's finally fixed in the new 5.3 version.
So for those who are facing this issue, just update pyinstaller to the latest version (5.3+).
Now the "_MEIxxxxxx" folder gets deleted if we close the parent console window or terminate the process in task-manager or even if we shutdown the system.
You can view the full changelog here