2016-07-05 170 views
2

我只想從scipy.io導入wavfile。Python:即使安裝了scipy,也無法導入scipy.io

import scipy     # this works 
import scipy.io    # this does NOT work 
from scipy.io import wavfile # does NOT work 

是的,我已經重新安裝python像4次。是的,我也嘗試了多次通過Anaconda安裝。是的,我試過Anaconda 2.7和3.5。不,它不起作用。請幫忙。

+0

'scipy import io as scipy_io'怎麼樣? –

+0

「scipy .__ version__」顯示什麼?聽起來你可以通過conda安裝它。如果你將它安裝在一個名爲'X'的環境中,'scipy'包在這裏看起來像什麼'CONDA_HOME/envs/X/lib/python3.5/site-packages/scipy /'? – Paul

回答

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 
相關問題