CPU架构
Python中,platform模块给提供了很多方法去获取操作系统的信息。下面是几种常用信息代码示例:
import platform print(platform.platform()); #获取操作系统名称及版本号 print(platform.version()); #获取操作系统版本号 print(platform.architecture()); #获取操作系统的位数,('64bit', 'ELF') print(platform.machine()); #计算机类型,'aarch64' print(platform.node()); #计算机的网络名称 print(platform.processor()); #计算机处理器信息,'aarch64' print(platform.uname()); #包含上面所有的信息汇总
鲲鹏上执行结果:
[root@centos7 test]# python test.py Linux-4.14.0-115.el7a.0.1.aarch64-aarch64-with-centos-7.6.1810-AltArch #1 SMP Sun Nov 25 20:54:21 UTC 2018 ('64bit', 'ELF') aarch64 centos7 aarch64 ('Linux', 'centos7', '4.14.0-115.el7a.0.1.aarch64', '#1 SMP Sun Nov 25 20: 54:21 UTC 2018', 'aarch64', 'aarch64')
父主题: Python