Getting total/free RAM from within Python

后端 未结 5 1696
被撕碎了的回忆
被撕碎了的回忆 2021-02-08 15:59

From within a Python application, how can I get the total amount of RAM of the system and how much of it is currently free, in a cross-platform way?

Ideally, the amount

5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-08 16:32

    For the free memory part, there is a function in the wx library:

    wx.GetFreeMemory()
    

    Unfortunately, this only works on Windows. Linux and Mac ports either return "-1" or raise a NotImplementedError.

提交回复
热议问题