如何使用Python查找系统类型?

时间:2012-03-29 14:55:42

标签: python

我们如何使用Python找到系统类型(即32位或64位)?

3 个答案:

答案 0 :(得分:3)

platform模块提供此类信息。例如:

>>> platform.architecture()
('32bit', 'ELF')

sys.platformsys.byteorder中提供了更多与架构相关的信息。

答案 1 :(得分:2)

答案 2 :(得分:1)

32位版本的Python(无论安装它的架构如何):

>>> import platform
>>> platform.architecture()
('32bit', 'WindowsPE')

64位版本的Python:

>>> import platform
>>> platform.architecture()
('64bit', 'WindowsPE')