Monday, May 29, 2017

Python to get sys info on Raspberry Pi, using platform library

Python code to get system info using platform library. Work on both Python 2 and 3. Tested on Raspberry Pi 2 running Raspbian Jessie with PIXEL rel. 2017-04-10.



pySysInfo.py
import platform

print("architecture: \t\t\t"
      + str(platform.architecture()))
print("machine: \t\t\t"
      + platform.machine())
print("node: \t\t\t\t"
      + platform.node())
print("platform: \t\t\t"
      + platform.platform())
print("processor: \t\t\t"
      + platform.processor())
print("python_build: \t\t\t"
      + str(platform.python_build()))
print("python_compiler: \t\t"
      + platform.python_compiler())
print("python_branch: \t\t\t"
      + platform.python_branch())
print("python_implementation(): \t"
      + platform.python_implementation())
print("python_revision: \t\t"
      + platform.python_revision())
print("python_version: \t\t"
      + platform.python_version())
print("python_version_tuple: \t\t"
      + str(platform.python_version_tuple()))
print("release: \t\t\t"
      + platform.release())
print("system: \t\t\t"
      + platform.system())
print("version: \t\t\t"
      + platform.version())

print("Uname: \n"
      + str(platform.uname()))



Reference:
https://docs.python.org/2/library/platform.html
https://docs.python.org/3/library/platform.html


No comments: