我最近正确安装了numpy和scipy。以下行运行无错误。
import scipy
我在使用 scipy.io.wavefile 时遇到困难。我一直在尝试使用this post的“最佳答案”中的代码。
但是,当我尝试第一行时,
from scipy.io import wavfile
我收到以下错误和回溯,
Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> from scipy.io import wavfile File "C:\Users\Me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\io\__init__.py", line 97, in <module> from .matlab import loadmat, savemat, whosmat, byteordercodes File "C:\Users\Me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\io\matlab\__init__.py", line 13, in <module> from .mio import loadmat, savemat, whosmat File "C:\Users\Me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\io\matlab\mio.py", line 12, in <module> from .miobase import get_matfile_version, docfiller File "C:\Users\Me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\io\matlab\miobase.py", line 22, in <module> from scipy.misc import doccer File "C:\Users\Me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\misc\__init__.py", line 68, in <module> from scipy.interpolate._pade import pade as _pade File "C:\Users\Me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\interpolate\__init__.py", line 175, in <module> from .interpolate import * File "C:\Users\Me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\interpolate\interpolate.py", line 21, in <module> import scipy.special as spec File "C:\Users\Me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\special\__init__.py", line 640, in <module> from ._ufuncs import * File "_ufuncs.pyx", line 1, in init scipy.special._ufuncs ImportError: DLL load failed: The specified module could not be found.
如果我尝试以下一行,我也会收到错误和回溯信息,
import scipy.io.wavfile
收到不同的答复,
Traceback (most recent call last): File "<pyshell#1>", line 1, in <module> import scipy.io.wavfile File "C:\Users\Me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\io\__init__.py", line 97, in <module> from .matlab import loadmat, savemat, whosmat, byteordercodes File "C:\Users\Me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\io\matlab\__init__.py", line 13, in <module> from .mio import loadmat, savemat, whosmat File "C:\Users\Me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\io\matlab\mio.py", line 12, in <module> from .miobase import get_matfile_version, docfiller File "C:\Users\Me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\io\matlab\miobase.py", line 22, in <module> from scipy.misc import doccer File "C:\Users\Me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\misc\__init__.py", line 68, in <module> from scipy.interpolate._pade import pade as _pade File "C:\Users\Me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\interpolate\__init__.py", line 175, in <module> from .interpolate import * File "C:\Users\Me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\interpolate\interpolate.py", line 21, in <module> import scipy.special as spec File "C:\Users\Me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\special\__init__.py", line 642, in <module> from .basic import * File "C:\Users\Me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\scipy\special\basic.py", line 15, in <module> from ._ufuncs import (ellipkm1, mathieu_a, mathieu_b, iv, jv, gamma, ImportError: cannot import name 'ellipkm1' from 'scipy.special._ufuncs' (unknown location)
我不明白为什么如果正确安装了scipy并可以自行导入该模块,为什么找不到该模块。我正在使用python 3.7.1。帖子中的代码可以折旧吗? 对于长篇文章,请提前致歉。
答案 0 :(得分:1)
两条错误消息都抱怨scipy.special._ufuncs模块,快速搜索显示了另外几篇帖子like this one,这些帖子建议确保您已安装Visual C ++可再发行组件包:https://www.microsoft.com/en-us/download/details.aspx?id=48145