Python3.5安装numpy,SciPy后,出现ImportError

来源:互联网 发布:子域名查询工具3.0 编辑:程序博客网 时间:2024/06/05 10:03

本来想安装机器学习库scikit-learn,但是发现它要求安装numpy,SciPy,结果花了一整天才配置成功。

1、建议直接到http://www.lfd.uci.edu/~gohlke/pythonlibs/ 中下载对应的numpy,scipy版本,然后在dos环境下,pip install 文件名.whl 即可安装。

如果去PyPI下载的源文件用python setup.py install 安装,则有可能vs版本不匹配而导致编译不通过。


2、安装成功后,可以正常import,但是from scipy import sparse 时报错ImportError: DLL load failed。


这个问题我找了一整天,最后发现也是vs版本不同,导致部分dll缺失:

http://www.lfd.uci.edu/~gohlke/pythonlibs  开头指出:

Many binaries depend on NumPy-1.9+MKL and the Microsoft Visual C++ 2008 (x64, x86, and SP1 for CPython 2.6 and 2.7), Visual C++ 2010 (x64, x86, for CPython 3.3 and 3.4), or the Visual C++ 2015 (x64 and x86 for CPython 3.5) redistributable packages.

但是安装vs2015没能解决这个问题,最后在stackoverflow上找到了答案:

Download the corresponding Microsoft Visual C++ Redistributable Package which should be this one based on your description.

链接:http://stackoverflow.com/questions/33600302/installing-scipy-in-python-3-5-on-32-bit-windows-7-machine

 安装Microsoft Visual C++ Redistributable Package后,问题解决。下载地址:

https://www.microsoft.com/en-us/download/details.aspx?id=48145



1 0
原创粉丝点击