Interpreter


In [2]:
import platform
print('Version:', platform.python_version())
print('Version tuple:', platform.python_version_tuple())
print('Compiler:', platform.python_compiler())
print('Buil:', platform.python_build())


Version: 3.6.0
Version tuple: ('3', '6', '0')
Compiler: GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)
Buil: ('default', 'Dec 23 2016 13:19:00')

Platform


In [3]:
import platform
print('Normal:', platform.platform())
print('Aliased:', platform.platform(aliased=True))
print('Terse:', platform.platform(terse=True))


Normal: Darwin-16.5.0-x86_64-i386-64bit
Aliased: Darwin-16.5.0-x86_64-i386-64bit
Terse: Darwin-16.5.0

Operating System and Handware Info


In [4]:
import platform

print('uname:', platform.uname())

print()
print('system   :', platform.system())
print('node     :', platform.node())
print('release  :', platform.release())
print('version  :', platform.version())
print('machine  :', platform.machine())
print('processor:', platform.processor())


uname: uname_result(system='Darwin', node='gaofeng.local', release='16.5.0', version='Darwin Kernel Version 16.5.0: Fri Mar  3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64', machine='x86_64', processor='i386')

system   : Darwin
node     : gaofeng.local
release  : 16.5.0
version  : Darwin Kernel Version 16.5.0: Fri Mar  3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64
machine  : x86_64
processor: i386

Executable Architecture


In [5]:
import platform

print('interpreter:', platform.architecture())
print('/bin/ls    :', platform.architecture('/bin/ls'))


interpreter: ('64bit', '')
/bin/ls    : ('64bit', '')