检测64位操作系统(Windows)在Python操作系统、Python、Windows

2023-09-07 17:51:12 作者:尨浩

有谁知道我怎么会去检测什么位版本的Windows是Python的下。我需要知道这是用正确的文件夹,程序文件的方式。

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.

感谢

推荐答案

平台模块 - 访问底层平台的识别数据

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

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

在64位Windows,32位Python的回报:

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.