我如何检测是否Python的运行为64位应用程序? [英] How do I detect if Python is running as a 64-bit application?
问题描述
可能重复:
<一href="http://stackoverflow.com/questions/1405913/how-do-i-determine-if-my-python-shell-is-executing-in-32bit-or-64bit-mode">How我确定我的蟒蛇壳正在执行的32位或64位模式?
我在做与Windows注册表中的某些工作。根据您是否正在运行Python作为32位或64位的密钥值会有所不同。如何检测,而不是一个32位应用程序,如果Python的运行为64位应用程序?
注:我没有兴趣在检测的32位/ 64位Windows - 只是Python的平台
进口平台
platform.architecture()
从 Python文档:
查询给定的可执行文件(默认 为Python的跨preTER二进制) 不同体系结构的信息。
返回一个元组(比特,联动),其 包含有关比特信息 架构和联动格式 用于可执行文件。这两个值 返回字符串。
Possible Duplicate:
How do I determine if my python shell is executing in 32bit or 64bit mode?
I'm doing some work with the windows registry. Depending on whether you're running python as 32-bit or 64-bit, the key value will be different. How do I detect if Python is running as a 64-bit application as opposed to a 32-bit application?
Note: I'm not interested in detecting 32-bit/64-bit Windows - just the Python platform.
import platform
platform.architecture()
From the Python docs:
Queries the given executable (defaults to the Python interpreter binary) for various architecture information.
Returns a tuple (bits, linkage) which contain information about the bit architecture and the linkage format used for the executable. Both values are returned as strings.
这篇关于我如何检测是否Python的运行为64位应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!