我的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\\setup.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?
答案 0 :(得分:1)
通过从http://www.lfd.uci.edu/~gohlke/pythonlibs/安装python 3.4和3.4依赖项来解决此问题。似乎错误只能由python 3.5环境重现。
正确的环境配置是: