ImportError:没有名为<模块名称>的模块

时间:2019-08-06 10:25:06

标签: python module package

我知道这个问题已经被问过很多次了,但是我仍然无法弄清楚我的情况是怎么回事。

这是我的包裹结构。

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() 

0 个答案:

没有答案
相关问题