python判断系统32位64位_Python的 - 检查,如果系统是32位还是64位,以确定是否运行功能或不?...

I made a question earlier that never got replied to, but I have something more specific now so hopefully you can help.

Basically the SendKeys library only appears to install on my 32 bit system of Windows...

So I was wondering if there is a way of making it so this function I am going to write will only execute on a 32 bit system? I realise there is a platform.architecture() method to check the current system, but it returns the string "('64bit', 'WindowsPE')".

I was wondering if there was a way to read the 64 bit part of this string to make this function work correctly.

For example, pseudo code:

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

Along the line of that. Unless there is a simpler way of checking it - maybe against the version of Python used (ie 32 or 64 bit)

Hope I've grasped this correctly - I'm still rather new to programming. :)

解决方案

Following this documentation, try this code:

is_64bits = sys.maxsize > 2**32

Note: this can return an incorrect result if 32bit Python is running on a 64bit operating system.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值