为什么Python2.7AMD64安装程序似乎以32位模式运行Python?

为什么Python2.7AMD64安装程序似乎以32位模式运行Python?,python,windows,64-bit,Python,Windows,64 Bit,我已经从Python.org的Python-2.7.amd64.msi包中安装了python2.7。它安装和运行正确,但似乎处于32位模式,尽管安装程序是64位安装程序 Python 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>

我已经从Python.org的Python-2.7.amd64.msi包中安装了python2.7。它安装和运行正确,但似乎处于32位模式,尽管安装程序是64位安装程序

Python 2.7 (r27:82525, Jul  4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, platform
>>> platform.architecture()
('64bit', 'WindowsPE')
>>> sys.maxint
2147483647
如何安装Python,使其真正以64位模式运行?

请参阅讨论。它来自2.6.1,但似乎仍然适用。至少在任何地方我都没有看到相反的证据。这件事的要点(引自该链接)是:

这是故意的。微软以其无限的智慧决定 使“long”C类型始终为32位带符号整数-即使是64位 系统。在大多数Unix系统上,long至少为32位,但通常为 sizeof(ptr)

在我的x86-64 Linux上:

$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, platform
>>> platform.architecture()
('64bit', 'ELF')
>>> sys.maxint
9223372036854775807

当然,比整数大小更重要的是可以分配多少内存。也许较小的整数并不重要,因为Python会以任何方式升级为
long
,但是如果您可以分配超过3 Gig的内存,您仍然可以享受64位执行的好处。

感谢指针,我认为sys.maxint是检查当前Python解释器位的可靠方法。有趣的是,在Mac OS X上,platform.architecture()对我来说是错误的,sys.maxint是正确的。但在窗户上,它显然是相反的。。。再次感谢。将我所有的值更改为显式浮点值,这使得我在Linux系统上编写的一系列单元测试在我的Windows机器上停止失败。在python 3.2中,sys.maxint常量被删除了,因为整数的值不再有限制。但是,sys.maxsize可以用作大于任何实际列表或字符串索引的整数。在Python3.2中,32位sys.maxsize是2147483647,在Python3.2中,64位sys.maxsize是9223372036854775807。我在64位Windows上使用了python,但我仍然得到了`>>sys.maxint 2147483647>>platform.architecture()