platform — Access underlying platform identification data

This module implements a subset of the corresponding CPython module, as described below. For more information, please refer to the original CPython documentation: platform

This module tries to retrieve as much platform identification data as possible. It provides this information through a function API.

Quick usage example:

import platform

# Get platform information
print('Platform:', platform.platform())
print('Python compiler:', platform.python_compiler())
print('Libc version:', platform.libc_ver())
print('Processor:', platform.processor())

Functions

platform.platform()

Return a string identifying the underlying platform. This string consists of several substrings in the following order, separated by hyphens (-):

  • The name of the platform system (e.g. Unix, Windows or MicroPython)

  • The MicroPython version

  • The architecture of the platform

  • The version of the underlying platform

  • The name of the libc that MicroPython is linked against and its corresponding version, joined.

For example, this could be “MicroPython-1.20.0-xtensa-IDFv4.2.4-with-newlib3.0.0”.

platform.python_compiler()

Return a string identifying the compiler used to compile MicroPython.

platform.libc_ver()

Return a tuple of strings (lib, version), where lib is the name of the libc that MicroPython is linked against, and version is the corresponding version of that libc.

platform.processor()

Return a string containing the detailed name of the processor (if available). If the name of the processor is not known, it will return an empty string. This is currently only available on RISC-V targets (32-bit and 64-bit).