是否存在使用Python确定系统CPU架构的可靠方法? [英] Is there a reliable way to determine the system CPU architecture using Python?

查看:103
本文介绍了是否存在使用Python确定系统CPU架构的可靠方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
如何在Python中返回系统信息?

Possible Duplicate:
How can I return system information in Python?

例如,查看Solaris是Solaris X86还是Solaris SPARC?

For example, to see if a Solaris is a Solaris X86 or Solaris SPARC?

推荐答案

我使用了以下内容:

>>> import platform
>>> platform.uname()
('Darwin', 'Matthew-Rankins-MacBook-Pro.local', '10.8.0', 
'Darwin Kernel Version 10.8.0: Tue Jun  7 16:32:41 PDT 2011; 
root:xnu-1504.15.3~1/RELEASE_X86_64', 'x86_64', 'i386')
>>> 

Python平台文档:

platform.uname()

可移植的uname界面.返回标识基础平台的字符串(系统,节点,发行版,版本,机器,处理器)的元组.

Fairly portable uname interface. Returns a tuple of strings (system, node, release, version, machine, processor) identifying the underlying platform.

请注意,与os.uname()函数不同的是,它还会返回可能的处理器信息作为其他元组条目.

Note that unlike the os.uname() function this also returns possible processor information as additional tuple entry.

无法确定的条目设置为".

Entries which cannot be determined are set to ''.

这篇关于是否存在使用Python确定系统CPU架构的可靠方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆