用更多的python进程杀死python进程的脚本名称中的一个python

2024-05-12 13:00:47 发布

您现在位置:Python中文网/ 问答频道 /正文

在我的windows服务器上,有两三个python进程正在运行。 例如:

C:\Users\nithya>wmic processess where caption="python.exe" get commandline
CommandLine

python  -i -Wignore sample_test.py
"C:\Python27\python.exe" "C:\examples\testing.py" --q
"C:\Python27\python.exe" "C:\examples\gui.py"  --i

从上述过程中,我想杀死样品_测试.py从测试.py或来自图形用户界面.py使用python代码。你知道吗

有没有安全的方法只杀死那个python进程而不杀死所有python进程?你知道吗

哪种方法最好?可能是psutil、os或子进程?你知道吗

提前谢谢。你知道吗


Tags: 方法py服务器get进程windowswhereexe