all Python 3platformfunction
platform.architecture()
system and machine
Returns the bitness and linkage format of an executable, the interpreter by default: ('64bit', 'ELF').
Syntax
bits, linkage = platform.architecture(executable=sys.executable, bits='', linkage='')
It relies on the system file utility, and on macOS universal binaries it may report a bitness other than the one the code actually runs under. To check whether the running interpreter is 64-bit, sys.maxsize > 2**32 is more reliable. It says nothing about the OS: a 32-bit Python on 64-bit Windows answers '32bit'.
Examples
import platform, sys
print(platform.architecture()) # → ? например ('64bit', 'ELF') на Linux, ('64bit', 'WindowsPE') на Windows
print(type(platform.architecture()).__name__) # → tuple
print(sys.maxsize > 2**32) # → ? True у 64-битного интерпретатора — надёжнее architecture()
See also
Open in the full glossarydocs.python.orgReport an inaccuracy