在 Python 中检测 64 位操作系统(Windows) [英] Detect 64bit OS (windows) in Python

查看:27
本文介绍了在 Python 中检测 64 位操作系统(Windows)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道我将如何检测 Python 下的 Windows 位版本.我需要知道这是为程序文件使用正确文件夹的一种方式.

非常感谢

解决方案

platform module -- 访问底层平台的识别数据

<预><代码>>>>进口平台>>>平台.架构()('32bit', 'WindowsPE')

在 64 位 Windows 上,32 位 Python 返回:

('32bit', 'WindowsPE')

这意味着这个答案,即使已被接受,也是不正确的.请参阅下面的一些答案,了解可能适用于不同情况的选项.

Does anyone know how I would go about detected what bit version Windows is under Python. I need to know this as a way of using the right folder for Program Files.

Many thanks

解决方案

platform module -- Access to underlying platform’s identifying data

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

On 64-bit Windows, 32-bit Python returns:

('32bit', 'WindowsPE')

And that means that this answer, even though it has been accepted, is incorrect. Please see some of the answers below for options that may work for different situations.

这篇关于在 Python 中检测 64 位操作系统(Windows)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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