在 64 位 Windows 上用于 Python 2.7 的 NumPy
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14762248/
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
NumPy for Python 2.7 on 64 bit Windows
提问by user2052579
I have been trying to get NumPy for Python 2.7 on Windows 64 bit, but the page http://www.lfd.uci.edu/~gohlke/pythonlibs/that everyone mentions isn't opening on any of my devices.
我一直在尝试在 Windows 64 位上为 Python 2.7 获取 NumPy,但是每个人都提到的页面http://www.lfd.uci.edu/~gohlke/pythonlibs/没有在我的任何设备上打开。
Is there somewhere else I may find it?
有没有其他地方我可以找到它?
回答by JCash
I don't know where else to find it but I'd like to mention that it actually isn't that difficult to build yourself, if you have the numpy source and a MSVC compiler.
我不知道还能在哪里找到它,但我想提一下,如果您有 numpy 源代码和 MSVC 编译器,那么构建自己实际上并不难。
Numpy builds using the python distutils package and as such deals with manifest files. If you are using VC9 then you can probably go right ahead.
Numpy 使用 python distutils 包构建,因此处理清单文件。如果您使用的是 VC9,那么您可能可以继续。
I did this today using the VC10 compiler, and as such had to alter my distutils package (msvc9compiler.py) to not handle any manifests. I simply commented out those lines. Then before I built the package, I set the env var to point to my actual compiler:
我今天使用 VC10 编译器完成了此操作,因此必须更改我的 distutils 包 (msvc9compiler.py) 以不处理任何清单。我只是注释掉了这些行。然后在构建包之前,我将 env var 设置为指向我的实际编译器:
set VS90COMNTOOLS=%VS100COMNTOOLS%
c:\python27_64\python.exe setup.py build
And after the build, I find the numpy package in the build folder.
在构建之后,我在构建文件夹中找到了 numpy 包。
Numpy complains a lot about ATLAS and BLAS and stuff, but in the end, you'll get a compiled numpy that will run the tests successfully.
Numpy 经常抱怨 ATLAS 和 BLAS 之类的东西,但最后,你会得到一个编译好的 numpy,它可以成功运行测试。
回答by Steve Byrnes
I suggest WinPython, a Python 2.7 distribution for Windows with both 32- and 64-bit versions.
我建议使用WinPython,这是一个适用于 Windows 的 Python 2.7 发行版,具有 32 位和 64 位版本。
This blog postby the WinPython creator explains why it is generally difficult to find 64-bit Windows NumPy:
WinPython 创建者的这篇博文解释了为什么通常很难找到 64 位 Windows NumPy:
According to experienced developers, there is no decent open-source (free) Fortran compiler for the Windows 64bit platform. As a consequence, it's impossible to build NumPy or SciPy on this platform using only free and open-source tools. That's why there is no official Windows 64bit binaries for these two libraries. The only ready-to-use installers available out there were prepared by Christoph Gohlke (using Intel Fortran compiler, a.k.a. 'ifort') and these are clearly unofficial binaries. Furthermore, Christoph has built two different installers for NumPy: one unoptimized and one optimized with the Intel Math Kernel Library (MKL), hence providing better performance. And Gohlke's SciPy 64bit binary package (the only one available freely online) require NumPy MKL. The problem is that, according to Christoph Gohlke, the MKL license does not allow me (or anyone else) to redistribute these binaries, unless I have purchased such a license. It is still unclear to me if the end user would also require this license too. Hopefully no. Let's assume that. Besides, after reading carefully the Intel MKL License terms, I'm quite sure that I can redistribute the MKL-based NumPy built because it's just runtime redistribution. So I think I will purchase an Intel Fortran Compiler license (including MKL) to be able to rebuild NumPy and SciPy in the near future but in the meantime I will just redistribute the packages built by Christoph Gohlke.
根据经验丰富的开发人员的说法,Windows 64 位平台没有像样的开源(免费)Fortran 编译器。因此,仅使用免费和开源工具在此平台上构建 NumPy 或 SciPy 是不可能的。这就是为什么没有这两个库的官方 Windows 64 位二进制文件的原因。唯一可用的即用型安装程序是由 Christoph Gohlke(使用英特尔 Fortran 编译器,又名“ifort”)准备的,这些显然是非官方的二进制文件。此外,Christoph 为 NumPy 构建了两种不同的安装程序:一种未优化,一种使用英特尔数学内核库 (MKL) 优化,从而提供更好的性能。Gohlke 的 SciPy 64 位二进制包(唯一可以在线免费获得的)需要 NumPy MKL。问题在于,根据克里斯托夫·戈尔克(Christoph Gohlke)的说法,MKL 许可证不允许我(或其他任何人)重新分发这些二进制文件,除非我购买了这样的许可证。我仍然不清楚最终用户是否也需要此许可证。希望没有。让我们假设。此外,在仔细阅读英特尔 MKL 许可条款后,我非常确定我可以重新分发基于 MKL 的 NumPy 构建,因为它只是运行时重新分发。所以我想我会购买一个英特尔 Fortran 编译器许可证(包括 MKL),以便能够在不久的将来重建 NumPy 和 SciPy,但同时我将重新分发由 Christoph Gohlke 构建的软件包。此外,在仔细阅读英特尔 MKL 许可条款后,我非常确定我可以重新分发基于 MKL 的 NumPy 构建,因为它只是运行时重新分发。所以我想我会购买一个英特尔 Fortran 编译器许可证(包括 MKL),以便能够在不久的将来重建 NumPy 和 SciPy,但同时我将重新分发由 Christoph Gohlke 构建的软件包。此外,在仔细阅读英特尔 MKL 许可条款后,我非常确定我可以重新分发基于 MKL 的 NumPy 构建,因为它只是运行时重新分发。所以我想我会购买一个 Intel Fortran Compiler 许可证(包括 MKL),以便能够在不久的将来重建 NumPy 和 SciPy,但同时我只会重新分发由 Christoph Gohlke 构建的软件包。

