我正在尝试使用scipy读取*.wav文件.我做以下事情:
import scipy
x = scipy.io.wavfile.read('/usr/share/sounds/purple/receive.wav')
Run Code Online (Sandbox Code Playgroud)
这个代码的结果我得到:
Traceback (most recent call last):
File "test3.py", line 2, in <module>
x = scipy.io.wavfile.read('/usr/share/sounds/purple/receive.wav')
AttributeError: 'module' object has no attribute 'io'
Run Code Online (Sandbox Code Playgroud)
有人知道这里有什么问题吗?先感谢您.
正如错误所说,scipy模块没有'io'.
io.wavfile是一个子模块,你需要from scipy.io import wavfile然后做wavfile.read("/usr/share/sounds/purple/receive.wav")
这给我一个错误,你正在使用的文件作为一个例子,但是......