简体   繁体   English

pyinstaller:我的cherrypy app exe的2个实例被执行

[英]pyinstaller: 2 instances of my cherrypy app exe get executed

I have a cherrypy app that I've made an exe with pyinstaller. 我有一个樱桃应用程序,我用pyinstaller制作了一个exe。 now when I run the exe it loads itself twice into memory. 现在,当我运行exe时,它会将自身加载到内存中两次。 Watching the taskmanager shows the first instance load into about 1k, then a second later a second instance of hte exe loads into about 3k ram. 观察任务管理器显示第一个实例加载到大约1k,然后一秒钟后,第二个实例加载到大约3k ram。 If I close the bigger one both processes die. 如果我关闭较大的一个,两个进程都会死掉。 If I close hte smaller one only that one dies. 如果我关闭较小的一个只有一个死亡。

Loading the exe with subprocess, if I try to proc.kill(), it only kills the small one leaving the other running in memory. 使用subprocess加载exe,如果我尝试proc.kill(),它只会杀死小的,而另一个在内存中运行。 Is this a sideeffect of using cherrypy and pyinstaller together? 这是一起使用cherrypy和pyinstaller的副作用吗?

PyInstaller spawns a subprocess during its boot process. PyInstaller在引导过程中产生一个子进程。 This is explained in a section of its manual . 这在其手册的一节中有解释。

It would be important to know what version of CherryPy you are using. 了解您正在使用的CherryPy版本非常重要。 The 2.x line had an unfortunate design: the autoreloader feature always started a second instance of CherryPy, so the first could respawn the child when it was killed off. 2.x系列有一个不幸的设计:autoreloader功能总是启动CherryPy的第二个实例,所以第一个实例可以在孩子被杀死时重生。 That was fixed in version 3 to only use one process. 在版本3中修复了它只使用一个进程。 If you are using version 2, turn off the autoreload feature via the config entry: 如果您使用的是版本2,请通过config条目关闭自动加载功能:

[global]
autoreload.on = False

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

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