首页 > 解决方案 > 无法导入声音文件 (mac)

问题描述

尝试时出现错误import soundfile

我尝试通过 pip 重新安装声音文件,但没有奏效。

这是我得到的错误。

Traceback (most recent call last):
  File "/Users/kona/.pyenv/versions/3.9.5/lib/python3.9/site-packages/soundfile.py", line 142, in <module>
    raise OSError('sndfile library not found')
OSError: sndfile library not found

During handling of the above exception, another exception occured:

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/Users/kona/.pyenv/versions/3.9.5/lib/python3.9/site-packages/soundfile.py", line 162, in <module>
        _snd = _ffi.dlopen(_os.path.join(
    OSError: cannot load library '/Users/kona/.pyenv/versions/3.9.5/lib/python3.9/site-packages/_soundfile_data/libsndfile.dylib': dlopen(/Users/kona/.pyenv/versions/3.9.5/lib/python3.9/site-packages/_soundfile_data/libsndfile.dylib, 2): image not found

当我做mdfind _soundfile_datamdfind libsndfile.dylib时,它没有给我任何结果。另外,当我这样做时brew install libsndfile,它告诉我它是already installed and up-to-date

标签: pythonmacospyenvlibsndfilesoundfile

解决方案


推荐阅读