我只想从scipy.io导入wavfile。
import scipy # this works
import scipy.io # this does NOT work
from scipy.io import wavfile # does NOT work
是的,我重新安装了4次python。是的,我也尝试过多次通过Anaconda安装。是的,我尝试过Anaconda 2.7和3.5。不,它不起作用。请帮忙。
答案 0 :(得分:0)
您的scipy安装已损坏。它应该工作。
In [1]: from scipy.io import wavfile
In [2]: wavfile?
Type: module
String form: <module 'scipy.io.wavfile' from '/home/br/repos/scipy/build/testenv/lib/python2.7/site-packages/scipy/io/wavfile.pyc'>
File: /home/br/repos/scipy/build/testenv/lib/python2.7/site-packages/scipy/io/wavfile.py
Docstring:
Module to read / write wav files using numpy arrays
Functions
---------
`read`: Return the sample rate (in samples/sec) and data from a WAV file.
`write`: Write a numpy array as a WAV file.
In [3]: wavfile.<TAB>
wavfile.KNOWN_WAVE_FORMATS wavfile.numpy
wavfile.WAVE_FORMAT_EXTENSIBLE wavfile.print_function
wavfile.WAVE_FORMAT_IEEE_FLOAT wavfile.read
wavfile.WAVE_FORMAT_PCM wavfile.struct
wavfile.WavFileWarning wavfile.sys
wavfile.absolute_import wavfile.warnings
wavfile.division wavfile.write
答案 1 :(得分:0)
这是numpy mkl文件的问题。 转到https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy并下载相关版本的numpy + mkl,然后使用该版本重新安装numpy。