import scipy.sparse failed

匿名 (未验证) 提交于 2019-12-03 00:59:01

问题:

My python is 3.5.1 (32-bit) at Win7 (32-bit). I've installed 'scipy-0.16.1-cp35-none-win32.whl' and 'numpy-1.10.2+mkl-cp35-none-win32.whl' downloaded form http://www.lfd.uci.edu/~gohlke/pythonlibs/. And the scipy model can be imported correctly as below:

import scipy 

But I get the errors when importing 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. 

And I got the error below by installing scipy by pip:

pip install scipy 


How can I correctly import scipy.sparse?

回答1:

Fixed this issue by installing python 3.4 and 3.4 dependencies from http://www.lfd.uci.edu/~gohlke/pythonlibs/. It seems the error only reproduced by python 3.5 environment.

The correct environment configurations are:

  • OS: Win7 (32-bit)
  • Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
  • scipy-0.17.0rc1-cp34-none-win32.whl
  • numpy-1.10.2+mkl-cp34-none-win32.whl


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!