导入scipy.sparse失败

时间:2016-01-04 09:47:20

标签: python numpy scipy

我的python是Win7(32位)的3.5.1(32位)。我已经安装了scipy-0.16.1-cp35-none-win32.whl'和&numpy-1.10.2 + mkl-cp35-none-win32.whl'已下载http://www.lfd.uci.edu/~gohlke/pythonlibs/表格。 scipy模型可以正确导入,如下所示:

import scipy

但是我在导入scipy.sparse时遇到错误:

>>> import scipy.sparse
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\site-packages\scipy\sparse\__init__.py", line 213, in <module>
    from .csr import *
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\site-packages\scipy\sparse\csr.py", line 13, in <module>
    from ._sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \
ImportError: DLL load failed: The specified module could not be found.

我通过pip安装scipy得到了以下错误:

pip install scipy


Command 
  "c:\users\administrator\appdata\local\programs\python\python35-32\python.exe -c \
  """import setuptools, tokenize;
  __file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-build-qzcp2rwj\\scipy\\s‌​etup.py';
  exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))""" \
  install --record C:\Users\ADMINI~1\AppData\Local\Temp\pip-lyz7f9x_-record\install-record.txt \
  --single-version-externally-managed --compile"
failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-qzcp2rwj\scipy

如何正确导入scipy.sparse?

1 个答案:

答案 0 :(得分:1)

通过从http://www.lfd.uci.edu/~gohlke/pythonlibs/安装python 3.4和3.4依赖项来解决此问题。似乎错误只能由python 3.5环境重现。

正确的环境配置是:

  • OS:Win7(32位)
  • Python 3.4.3(v3.4.3:9b73f1c3e601,2015年2月24日,22:43:06)[MSC v.1600 32位(英特尔)]在win32上
  • SciPy的-0.17.0rc1-CP34-NONE-win32.whl
  • numpy的-1.10.2 + MKL-CP34-NONE-win32.whl