How can I return system information in Python?

后端 未结 7 1053
北荒
北荒 2020-12-01 02:44

Using Python, how can information such as CPU usage, memory usage (free, used, etc), process count, etc be returned in a generic manner so that the same code can be run on L

7条回答
  •  眼角桃花
    2020-12-01 03:41

    psutil should provide what you need:

    [...] cross-platform library for retrieving information on running processes and system utilization (CPU, memory, disks, network) [...]

    [...] supports Linux, Windows, OSX, FreeBSD and Sun Solaris, both 32-bit and 64-bit architectures [...]

提交回复
热议问题