How can I get the total physical memory within Python in a distribution agnostic fashion? I don't need used memory, just the total physical memory.
your best bet for a cross-platform solution is to use the psutil package (available on PyPI).
import psutil psuti.virtual_memory().total # total physical memory available in B
Documentation for virtual_memory is here.
virtual_memory
2.1m questions
2.1m answers
60 comments
57.0k users