我有一个python项目,它使用python socketserver监听tcp来接收数据。
我使用pyinstaller创建一个单一的可执行文件,现在我在linux上运行二进制程序,有两个进程。
[root@localhost vmagent]# ./vmagent 10.20.248.37 e93773b6-d04a-40b2-9c57-f4ff6995309b &
[1] 19236
[root@localhost vmagent]# ps -ef|grep vmagent
root 16475 16364 0 14:09 pts/2 00:00:00 tail -30f vmagent.log
root 19236 18581 2 15:21 pts/6 00:00:00 ./vmagent 10.20.248.37 e93773b6-d04a-40b2-9c57-f4ff6995309b
root 19246 19236 8 15:21 pts/6 00:00:00 ./vmagent 10.20.248.37 e93773b6-d04a-40b2-9c57-f4ff6995309b
root 19263 18581 0 15:22 pts/6 00:00:00 grep vmagent
[root@localhost vmagent]# 退出当前会话并重新登录后,仍有两个进程.我怎样才能使程序只有一个进程?
[root@localhost ~]# ps -ef|grep vmagent
root 16475 16364 0 14:09 pts/2 00:00:00 tail -30f vmagent.log
root 19236 1 0 15:21 ? 00:00:00 ./vmagent 10.20.248.37 e93773b6-d04a-40b2-9c57-f4ff6995309b
root 19246 19236 0 15:21 ? 00:00:00 ./vmagent 10.20.248.37 e93773b6-d04a-40b2-9c57-f4ff6995309b
root 19542 19505 0 15:34 pts/5 00:00:00 grep vmagent
[root@localhost ~]# 发布于 2017-04-14 18:09:41
这似乎就是pyinstaller的工作方式。请检查文档的这一部分https://pythonhosted.org/PyInstaller/advanced-topics.html#the-bootstrap-process-in-detail。
所以您的二进制文件没有启动两次,只是pyinstaller使用了两个进程。
https://stackoverflow.com/questions/43407350
复制相似问题