【发布时间】:2012-04-15 09:40:27
【问题描述】:
可能重复:
How do I determine if my python shell is executing in 32bit or 64bit mode?
我之前提出了一个从未得到答复的问题,但我现在有一些更具体的问题,希望您能提供帮助。
基本上,SendKeys 库似乎只安装在我的 32 位 Windows 系统上...
所以我想知道是否有办法使我要编写的这个函数只能在 32 位系统上执行?我意识到有一个 platform.architecture() 方法来检查当前系统,但它返回字符串“('64bit','WindowsPE')”。
我想知道是否有办法读取此字符串的 64 位部分以使此函数正常工作。
例如伪代码:
checker = platform.architecture()
system = strip or read 64 bit from checker string somehow
if system == 64 bit
then warn system is 64 bit and won't run function
else run function
沿着这条线。除非有更简单的方法来检查它——可能是针对所使用的 Python 版本(即 32 位或 64 位)
希望我已经正确掌握了这一点 - 我对编程还是很陌生。 :)
【问题讨论】:
-
是的,抱歉刚刚意识到这一点。不过,下面的答案似乎是迄今为止最简单的方法!
标签: python architecture bit