【问题标题】:python x86-64 installer on windows 7Windows 7 上的 python x86-64 安装程序
【发布时间】:2012-09-17 08:12:01
【问题描述】:

我正在尝试在 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

有什么想法吗?

问候, 波格丹

【问题讨论】:

  • 我猜这个差异是因为两个python版本可能是在不同的平台上编译的。
  • 但是 msi 安装程序是来自 python.org 的 Windows AMD64 / Intel 64 / X86-64 二进制文件,为什么它似乎只使用 32 位?

标签: python windows-7-x64


【解决方案1】:

这是因为Windows 64-bit ABI is different from Linux

Python 实现对 Python int 类型使用 C long 类型,而 C long 在 64 位 Windows 上仍然只有 32 位宽。

请参阅 Python 中的intobject.h

typedef struct {
    PyObject_HEAD
    long ob_ival;
} PyIntObject;

【讨论】:

    猜你喜欢
    • 2010-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-28
    相关资源
    最近更新 更多