Python 导入scipy.sparse失败

Python 导入scipy.sparse失败,python,numpy,scipy,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”下载表单。scipy模型可以正确导入,如下所示: import scipy 但我在导入scipy.sparse时遇到错误: >>> import scipy.sparse Traceback (most recent call last): File "&

我的python在Win7(32位)下是3.5.1(32位)。我已经安装了“scipy-0.16.1-cp35-none-win32.whl”和“numpy-1.10.2+mkl-cp35-none-win32.whl”下载表单。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.


如何正确导入scipy.sparse?

通过从安装python 3.4和3.4依赖项修复了此问题。这个错误似乎只在python 3.5环境中重现

正确的环境配置包括:

  • 操作系统:Win7(32位)
  • win32上的Python 3.4.3(v3.4.3:9b73f1c3e601,2015年2月24日,22:43:06)[MSC v.1600 32位(英特尔)]
  • scipy-0.17.0rc1-cp34-none-win32.whl
  • numpy-1.10.2+mkl-cp34-none-win32.whl

您没有使用pip安装scipy的任何原因?可能与从相对随机(imo)的位置下载有所不同。某些版本存在不兼容:。可能是这样的you@Evert,一般来说,这可能是正确的,但是Christoph Gohlke的python包并不是“一些相对随机的地方”。Christoph多年来一直提供Windows软件包。Christoph理应获得“scientific python hero”的称号,IMHO。我在Pippy直接安装scipy时犯了更多错误。你确定你有必要的依赖项,以便可以构建必要的DLL吗?我认为这是Christoph Gohlke的scipy和numpy包?不幸的是,它在python 3.5中失败了。这暗示了Python库有点不兼容。如果你在安装3.5版本的scipy时快速搜索,会弹出许多问题,因此很难找到是哪一个问题导致了你的问题(如果有),这使得很难知道它是否会在将来得到修复(当你想要升级时),或者它甚至是一个全新的问题。是的@Evert,这是Christoph的scipy和numpy。py-lib版本不兼容问题不容易解决。所以我列出了正确的版本。希望任何人都能从中受益:)@YB渴望坦克很多。你救了我的命:)。两天后,我终于发现python 3.5存在问题!
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