pythonsystem-information

How to get the system info with Python?


I need to get the info under what environment the software is running. Does python have a library for this purpose?

I want to know the following info.


Solution

  • some of these could be obtained from the platform module:

    >>> import platform
    >>> platform.machine()
    'x86'
    >>> platform.version()
    '5.1.2600'
    >>> platform.platform()
    'Windows-XP-5.1.2600-SP2'
    >>> platform.uname()
    ('Windows', 'name', 'XP', '5.1.2600', 'x86', 'x86 Family 6 Model 15 Stepping 6, GenuineIntel')
    >>> platform.system()
    'Windows'
    >>> platform.processor()
    'x86 Family 6 Model 15 Stepping 6, GenuineIntel'