关于python:如何在64位Windows上安装SciPy?

How do I install SciPy on 64 bit Windows?

如何在系统上安装scipy?

对于numpy部分(scipy依赖的部分),实际上有一个64位Windows的安装程序:numpy-1.3.0.win-amd64-py2.6.msi(是直接下载URL,2310144字节)。

运行scipy superpack安装程序会导致对话框中的消息:

Cannot install. Python version 2.6 required, which was not found in the registry.

我已经安装了python 2.6.2(和一个正在运行的django安装)但我不知道任何注册表的情况。

注册表项似乎已存在:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Python]

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore]

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6]

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\Help]

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\Help\Main Python Documentation]
@="D:\\Python262\\Doc\\python262.chm"

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\InstallPath]
@="D:\\Python262\"

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\InstallPath\InstallGroup]
@="
Python 2.6"

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\Modules]

[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.6\PythonPath]
@="
D:\\Python262\\Lib;D:\\Python262\\DLLs;D:\\Python262\\Lib\\lib-tk"

到目前为止我所做的:

步骤1

已下载Numpy Superpack安装程序numpy-1.3.0rc2-win32-superpack-python2.6.exe(直接下载URL,4782592字节)。运行此安装程序导致了相同的消息"无法安装"。Python需要2.6版,但在注册表中找不到。"。更新:实际上有一个numpy的安装程序可以工作-参见问题的开头。

步骤2

试图以另一种方式安装Numpy。下载了zip包numpy-1.3.0rc2.zip(直接下载URL,2404011字节)以正常方式将zip文件提取到临时目录,d: emp7umpy-1.3.0rc2(其中setup.py和readme.txt是)。然后我打开一个命令行窗口,并:

1
2
3
4
d:
cd D:\temp7
umpy-1.3.0rc2
setup.py install

这运行了很长时间,还包括使用cl.exe(Visual Studio的一部分)。这有将近5000条线转录本(230kb)。

这似乎奏效了。我现在可以在python中执行此操作:

1
2
import numpy as np
np.random.random(10)

结果如下:

1
2
array([ 0.35667511,  0.56099423,  0.38423629,  0.09733172,  0.81560421,
        0.18813222,  0.10566666,  0.84968066,  0.79472597,  0.30997724])

步骤3

下载了scipy Superpack安装程序scipy-0.7.1rc3-win32-superpack-python2.6.exe(直接下载URL,45597175字节)。运行此安装程序导致消息在开头列出

步骤4

试图以另一种方式安装scipy。下载了zip包scipy-0.7.1rc3.zip(直接下载URL,5506562字节),以正常方式将zip文件提取到临时目录,d: emp7scipy-0.7.1(其中setup.py以及readme.txt)。然后我打开一个命令行窗口,并:

1
2
3
d:
cd D:\temp7\scipy-0.7.1
setup.py install

这并没有取得多大的成就-这是一份抄本(大约95行)。

但失败了:

1
2
3
4
>>> import scipy as sp2
Traceback (most recent call last):
  File"<stdin>", line 1, in <module>
ImportError: No module named scipy

平台:python 2.6.2安装在目录d:python262中,Windows XP 64位SP2,8 GB RAM,Visual Studio 2008已安装专业版。

安装的python的启动屏幕是:

1
2
3
Python 2.6.2 (r262:71605, Apr 14 2009, 22:46:50) [MSC v.1500 64 bit (AMD64)] on win32
Type"help","copyright","credits" or"license" for more information.
>>>

路径值,在命令行窗口中设置的结果:

1
Path=D:\Perl64\site\bin;D:\Perl64\bin;C:\Program Files (x86)\PC Connectivity Solution\;D:\Perl\site\bin;D:\Perl\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;d:\Program Files (x86)\WinSCP\;D:\MassLynx\;D:\Program Files (x86)\Analyst\bin;d:\Python262;d:\Python262\Scripts;D:\Program Files (x86)\TortoiseSVN\bin;D:\Program Files\TortoiseSVN\bin;C:\WINDOWS\system32\WindowsPowerShell\v1.0;D:\Program Files (x86)\IDM Computer Solutions\UltraEdit\


有关numpy和scipy的非官方64位安装程序,请访问http://www.lfd.uci.edu/~gohlke/pythonlibs/

确保下载并安装软件包(aka.车轮)与您的cpython版本和位匹配(即cp35=python v3.5;win_amd64=x86_)。

您需要首先安装numpy;从具有系统范围(aka)管理员权限的命令提示符安装。程序文件)安装:

1
C:\>pip install numpy?<version>+mkl?cp<ver-spec>?cp<ver-spec>m?<cpu-build>.whl

或者包含从非admin命令提示安装到当前用户的应用程序文件夹(通常是Windows上的%APPDATA%\Python的EDOCX1〕标志:

1
C:\>pip install --user numpy?<version>+mkl?cp<ver-spec>?cp<ver-spec>m?<cpu-build>.whl

然后对scipy执行相同的操作:

1
C:\>pip install [--user] scipy?<version>?cp<ver-spec>?cp<ver-spec>m?<cpu-build>.whl

如果您复制并粘贴这些示例,请不要忘记适当地替换。此外,您必须使用上述ifd.uci.edu链接中的numpy&scipy包(否则,如果尝试混合和匹配不兼容的包——首先卸载任何冲突的包(即pip list),则会出现错误)。


简短回答:Windows 64位支持目前仍在进行中。超级包当然不能在64位的python上工作(但在32位的python上,甚至在Windows64位上,它也可以工作得很好)。

Windows64位的主要问题是,使用mingw-w64构建的系统目前不稳定:这可能是我们(numpy开发人员)的错误、python的错误或mingw-w64。最有可能是所有这些的组合。因此,您必须使用专有编译器:除Microsoft编译器以外的任何编译器都会随机崩溃;对于Fortran编译器,ifort是要使用的编译器。到目前为止,numpy和scipy源代码都可以使用Visual Studio 2008和ifort(所有测试都通过)进行编译,但是构建它仍然很困难,而且numpy构建基础结构不支持它。


正如scipy的成绩单告诉你的,scipy不应该在win64上工作:

1
2
Warning: Windows 64 bits support is experimental, and only available for
testing. You are advised not to use it for production.

所以我建议安装32位版本的python,不要再尝试自己构建scipy了。如果你仍然想尝试,你首先需要编译blas和lapack,正如piotrlegnica所说。在这些库中查找编译版本的地方,请参阅成绩单。


Winpython是一个开源发行版,有64位numpy和scipy。


另一种选择:http://www.pythonxy.com/

免费的,包括很多可以顺利合作的东西。

这个人说

Did you try linux.pythonxy ? ( http://linux.pythonxy.com ).

It's 64 bit ready ...

尽管我不太确定这意味着什么。

更新:

这个好像死了。我现在用的是Python,它有32位或64位安装程序。


为了完整性:enthuth有一个包含scipy的python发行版;但是,它不是免费的。警告:我从来没有用过。

最新消息:这个答案早就被遗忘了,直到一次投票把我带回来。在这个时候,我将第二次提出Python的建议,它是自由的。


我在64位Windows8.1计算机上有一个32位的python 3.5。我尝试了几乎所有可以在堆栈溢出中找到的方法,但没有人工作!

然后在这里我找到了它。上面写着:

SciPy is software for mathematics, science, and engineering.

Requires numpy+mkl.

Install numpy+mkl before installing scipy.

MKL很重要!但之前没人说过!

然后我安装了mkl:

1
2
3
4
C:\Users\****\Desktop\a> pip install mkl_service-1.1.2-cp35-cp35m-win32.whl
Processing c:\users\****\desktop\a\mkl_service-1.1.2-cp35-cp35m-win32.whl
Installing collected packages: mkl-service
Successfully installed mkl-service-1.1.2

然后我安装了scipy:

1
2
3
4
C:\Users\****\Desktop\a>pip install scipy-0.18.1-cp35-cp35m-win32.whl
Processing c:\users\****\desktop\a\scipy-0.18.1-cp35-cp35m-win32.whl
Installing collected packages: scipy
Successfully installed scipy-0.18.1

成功了~是的:)

小贴士:你只需谷歌"whl_file_name.whl"就可以知道从哪里下载它了~:)

更新:

经过所有这些步骤之后,您将发现您仍然无法在python 3中使用scipy。如果您打印"导入scipy",您会发现有错误消息,但不要担心,只有一件事要做。在这里--只需对这行进行注释,简单而有用。

1
from numpy._distributor_init import NUMPY_MKL

我保证这是最后一件事:)

Enter image description here

PS:在所有这些步骤之前,您最好先安装numpy。使用此命令非常简单:

1
pip install numpy


在Windows上独立安装这样的python数据科学包是很糟糕的。尝试anaconda(一个安装程序,400多个python包,py2&py3支持)。Python真的帮了我很多!


尝试在2.6.2上安装python 2.6.3(这也应该添加正确的注册表项),或者使用此脚本注册现有的安装。安装人员应该在那之后工作。

构建scipy需要一个Fortran编译器和库-blas和lapack。


我没有尝试过,但您可能想下载这个版本的可移植Python。它附带了在python 2.5.4上运行的scipy-0.7.0b1。


安装一个python发行版,http://www.python.org/download/。

下载并安装Python发行版。

如果您希望numpy、scipy或matplotlib在python 3.3中工作,请将anaconda-python分发链接到python 3.3,或者像这样使用它以仅具有python 2.7和更旧的功能。

博客文章anaconda python distribution python 3.3链接提供了关于anaconda的更多细节。


几天后我找到了这个解决方案。

首先,您要安装哪个python版本?

如果要使用Python 2.7版本:

步骤1:

scipy?0.19.0?cp27?cp27m?win32.whl

scipy?0.19.0?cp27?cp27m?win_amd64.whl

numpy?1.11.3+mkl?cp27?cp27m?win32.whl

numpy?1.11.3+mkl?cp27?cp27m?win_amd64.whl

如果要使用Python 3.4版本:

scipy?0.19.0?cp34?cp34m?win32.whl

scipy?0.19.0?cp34?cp34m?win_amd64.whl

numpy?1.11.3+mkl?cp34?cp34m?win32.whl

numpy?1.11.3+mkl?cp34?cp34m?win_amd64.whl

如果要使用Python 3.5版本:

scipy?0.19.0?cp35?cp35m?win32.whl

scipy?0.19.0?cp35?cp35m?win_amd64.whl

numpy?1.11.3+mkl?cp35?cp35m?win32.whl

努皮?1.11.3+mkl?CP35?CP35M?win_amd64.whl(赢_amd64.whl)

如果要使用Python 3.6版本:

scipy?0.19.0?cp36?cp36m?win32.whl

scipy?0.19.0?cp36?cp36m?win_amd64.whl

numpy?1.11.3+mkl?cp36?cp36m?win32.whl

numpy?1.11.3+mkl?cp36?cp36m?win_amd64.whl

链接:单击

完成安装后,转到您的目录。

例如,我的目录:

1
2
cd C:\Users\asus\AppData\Local\Programs\Python\Python35\Scripts>
pip install [where/is/your/downloaded/scipy_whl.]

第2步:

NumPy + MKL

再次从基于Python版本的同一个网站:

之后,在脚本文件夹中再次使用相同的内容:

1
2
3
cd C:\Users\asus\AppData\Local\Programs\Python\Python35\Scripts>

pip3 install [where/is/your/downloaded/numpy_whl.]

并在python文件夹中进行测试。

1
2
3
4
Python35>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type"help","copyright","credits" or"license" for more information.
>>> import scipy


您可以下载科学的python发行版。这里提到的其中一个:https://scipy.org/install.html

或者,如果您不能选择上述内容,可以从这里的WHL文件中选择pip install

http://www.lfd.uci.edu/~gohlke/pythonlibs/scipy


好吧,已经说了很多了,但是如果之前的答案都不起作用,你可以试试;

网址:https://www.scipy.org/install.html

根据他们;

For most users, especially on Windows, the easiest way to install the packages of the SciPy stack is to download one of these Python
distributions, which include all the key packages:

  • Anacond: A
    free distribution for the SciPy stack. Supports Linux, Windows and
    Mac.
  • Enthought Canopy: The free and commercial versions
    include the core SciPy stack packages. Supports Linux, Windows and
    Mac.
  • Python(x,y) A free distribution including the SciPy
    stack, based around the Spyder IDE. Windows only.
  • WinPython: A
    free distribution including the SciPy stack. Windows only.
  • Pyzo: A free distribution based on Anaconda and the IEP interactive
    development environment. Supports Linux, Windows and Mac.

对我来说,Python确实解决了这个问题。在下载之前一定要检查位(32/64位)版本,并根据安装的python发行版安装的python实现重新调整编译器。


好的,这里我将分享我在没有命令行的情况下在我的Windows PC上安装scipy所做的一切。

My PC configuration is Windows 7 64-bit and Python 2.7

  • 首先,我从http://www.lfd.uci.edu/~gohlke/pythonlibs/下载所需的包(哪个版本与您的配置相匹配,例如:cp27=>python2.7&cp35=>3.5)
  • 其次,我使用7-zip(也可以使用任何拉链,如winrar)提取文件。
  • 第三,我复制我提取的scipy文件夹,并将其粘贴到C:\Python27\Lib\site-packages中(或将其放在电脑中的确切位置,如..\..\Lib\site-packages中)。

NOTE: You have to install NumPy first before installing SciPy in this same way.


我在32位机器上也遇到了同样的错误。我通过注册我的python安装来修复它,使用脚本在:

http://effbot.org/zone/python-register.htm网站

脚本还可能使64位Superpack安装程序工作。