我知道这个问题已经被问过很多次了,但是我仍然无法弄清楚我的情况是怎么回事。
这是我的包裹结构。
sound/
__init__.py
formats/
__init__.py
wavread.py
wavwrite.py
aiffread.py
aiffwrite.py
auread.py
auwrite.py
effects/
__init__.py
echo.py
surround.py
reverse.py
filters/
__init__.py
equalizer.py
vocoder.py
karaoke.py
testsound.py
当我跑步时:
python testsound.py
失败:
from sound.formats.wavread import *
ImportError: No module named sound.formats.wavread
$ cat testsound.py
from filters import karaoke
def main():
karaoke.run()
$ cat karaoke.py
from sound.formats.wavread import * # ---> Fails Here
from sound.formats import wavwrite
def run():
readmusic() # This function is present in wavread
wavwrite.writeMusic()