我想通过python代码了解系统类型(os)。 我尝试过 platform.architecture() ,它返回 32 位,Windows PE,因为我的操作系统是 64 位。
如果系统类型(os)是32位,它将返回什么?
提前致谢!
最佳答案
import platform
platform.architecture()
('32bit', 'WindowsPE')
在 64 位 Windows 上,32 位 Python 返回:
('32bit', 'WindowsPE') # Don't know why.
一个好的方法是编写一个类似的函数
def check_os_type():
if platform.machine().endswith('64'):
return '64 bit'
if platform.machine().endswith('32'):
return '32 bit'
关于python-3.x - 如何通过python代码检测我的操作系统是32位还是64位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50214255/