Python 学习(一) 32位还是64位

打开Python看到如下信息:

Python 2.7(r27:82525,Jul 42010, 07:43:08)[MSC v.150064 bit (AMD64)] on win32Type"help","copyright","credits" or"license" for more information.

>>> import sys, platform

>>> platform.architecture()

('64bit','WindowsPE')

>>> sys.maxint2147483647

总是有些疑惑:我的python到底是32位还是64位呢?解释各不相同,

<code><span class="pun">第一种解释:<span class="pun"><span style="font-family:Arial;">I've installed Python 2.7 from the python-2.7.amd64.msi package from python.org. It installs and runs correctly, but seems to be in 32-bit mode, despite the fact that the installer was a 64 bit installer.参见:<a target=_blank target="_blank" href="http://stackoverflow.com/questions/3411079/why-does-the-python-2-7-amd-64-installer-seem-to-run-python-in-32-bit-mode%E3%80%82">http://stackoverflow.com/questions/3411079/why-does-the-python-2-7-amd-64-installer-seem-to-run-python-in-32-bit-mode。</a></span></span></span></code>
<code><span class="pun"><span class="pun"><span style="font-family:Arial;"><span style="font-family:Courier New;">系统仍然维持了一个sys<span class="pun">.</span><span class="pln">maxint的变量,值为 </span><span class="lit">2147483647。但是并不一定说这个python就是32位的。</span></span></span></span></span></code>
<code><span class="pun"><span class="pun"><span style="font-family:Arial;">第二种解释:</span></span></span></code>
<code><span class="pun">Python 2.7: Python的版本是2.7的</span></code>
<code><span class="pun">Win32 -> 指的就是Windows系统;</span></code>
<code><span class="pun">64 bit- > 指的是Windows是64位的;</span></code>
<code><span class="pun">AMD64 -> 指的就是 CPU是x64的</span><span class="pln">
</span></code>

第三种解释:

如何查看python是32位还是64位:参见 :http://blog.csdn.net/waleking/article/details/7566842 

import struct

struct.calcsize("P")

如果是4,说明是32位的;如果是其他的是,64位的。struct.calcsize用于计算格式字符串所对应的结果长度。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值