【问题标题】:In python, how to get the parent PID of specific child PID?在python中,如何获取特定子PID的父PID?
【发布时间】:2021-04-05 16:41:57
【问题描述】:

我需要获取特定 pid 的父 ID。 我能够使用psutil.process_iter() 获取可执行进程的 pid,但我需要知道这个 pid 的父进程是什么才能终止进程。

【问题讨论】:

标签: python


【解决方案1】:
psutil.Process(other_pid).ppid()

【讨论】:

  • 这行得通。谢谢。但是当我尝试做taskkill /PID <parent id> /T /F 我得到Error: The process <parent id> not found.
猜你喜欢
  • 2021-02-10
  • 2016-05-25
  • 2023-04-04
  • 1970-01-01
  • 2015-02-16
  • 2015-08-13
  • 1970-01-01
  • 2023-04-06
  • 1970-01-01
相关资源
最近更新 更多