windows 为什么 Python 2.7 AMD 64 安装程序似乎在 32 位模式下运行 Python?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3411079/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 14:58:46  来源:igfitidea点击:

Why does the Python 2.7 AMD 64 installer seem to run Python in 32 bit mode?

pythonwindows64-bit

提问by Bryan Catanzaro

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.

我已经从 python.org 的 python-2.7.amd64.msi 包安装了 Python 2.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

What can I do to install Python so that it actually runs in 64-bit mode?

我该怎么做才能安装 Python 以使其实际在 64 位模式下运行?

回答by eldarerathis

See the discussion here. It's from 2.6.1, but it seems to still apply. I haven't seen evidence to the contrary anywhere, at least. The gist of the matter (quoted from that link) is:

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

This is by design. In their infinitive wisdom Microsoft has decided to make the 'long' C type always a 32 bit signed integer - even on 64bit systems. On most Unix systems a long is at least 32 bit but usually sizeof(ptr).

这是设计使然。在他们的不定式智慧中,Microsoft 决定使“长”C 类型始终为 32 位有符号整数——即使在 64 位系统上也是如此。在大多数 Unix 系统上,long 至少是 32 位,但通常是 sizeof(ptr)。

回答by sarnold

On my x86-64 Linux:

在我的 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

Of course, what matters more than integer size is how much memory you can allocate. Maybe your smaller ints won't really matter much, since Python will just promote to a longany way, but if you can allocate more than three gigs of memory, you'll still be enjoying the benefits of 64 bit execution.

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