我正在尝试在 Windows 7 64 位虚拟机上安装 64 位版本的 python。我从 here 获得了 Python 2.7.3 Windows X86-64 安装程序.安装直接进行,但是当我启动 python 时,我得到:
Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win 32
如果我尝试:
import sys
sys.maxint
2147483647
这并不是我对 64 位 python 的真正期望,并且与我从我的 fedora 64 位安装中获得的不同:
9223372036854775807
有什么想法吗?
问候, 博格丹
请您参考如下方法:
这是因为Windows 64-bit ABI is different from Linux .
Python 实现使用 C long 类型作为 Python int 类型,而 C long 在 64 位 Windows 上仍然只有 32 位宽.
请参阅 Python 中的 intobject.h:
typedef struct {
PyObject_HEAD
long ob_ival;
} PyIntObject;
