我需要一个跨平台模块,允许我枚举机器上的进程。它需要在Windows和UNIX上工作,并获得PID和Process名称等事物。

是否有这样的模块?

有帮助吗?

解决方案

psutil should work nicely for this.

"psutil is a module providing an interface for retrieving information on all running processes and system utilization (CPU, memory) in a portable way by using Python, implementing many functionalities offered by command line tools like ps, top, kill, lsof and netstat."

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top