【问题标题】:Python sndfile library not found on newly installed Mac在新安装的 Mac 上找不到 Python sndfile 库
【发布时间】:2022-08-02 23:46:27
【问题描述】:

(我在这里的第一篇文章)我的 librosa python 库有问题,它会产生以下错误。

OSError:未找到 sndfile 库。

我使用 pip install 和 conda install -c conda-forge librosa 安装了 librosa 库和 SoundFile 库。我还在外部 git 文件夹中安装了带有 homebrew 的 libsndfile 库,但我不确定这是否是问题所在,如果是,我将安装库的 git 存储库放在哪里。

显然,python 环境尝试从 /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/_soundfile_data/libsndfile.dylib 检索库文件,但它们实际上位于 opt/homebrew/库/libsndfile.dylib。

我试过这样做:

  • 导出 CPATH=/opt/homebrew/include

  • 导出 LIBRARY_PATH=/opt/homebrew/lib

但它没有工作,我真的不知道还能做什么..

也许只是一些我没有安装或没有安装在正确目录中的库?

Screenshot of PyCharm console output after running a program that uses librosa

我正在使用全新的 MacBook Pro M1 Max

  • MacOS 蒙特雷
  • Python 3.9
  • librosa 0.9.1
  • 声音文件 0.10.3
  • 最新的 PyCharm 社区版

提前致谢!!

  • 这回答了你的问题了吗? MacOS brew install libsndfile but still not found
  • @esqew 有点,但不完全,所以我发现 opt/homebrew/Cellar/libsndfile/1.1.0/include 和 opt/anaconda/include 中有 sndfile.h 文件。我从您的链接线程执行了导出终端行,但没有任何改变,程序仍然有相同的错误。在 opt/homebrew/lib 下还有 PyCharm 所需的库文件(libvorbis..dylib 和 libsndfile.dylib)。但是我的全局或 conda python 环境显然找不到这些
  • 同样的问题 - 也尝试过该帖子但无济于事

标签: python pycharm librosa libsndfile soundfile


【解决方案1】:

对于使用 M1 cpu (arch arm64) 在 python 上的声音项目,我遇到了同样的问题。

  • conda install -c conda-forge libsndfile

在 python 3.10 上工作

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-02-01
    • 2016-12-19
    • 1970-01-01
    • 2016-02-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多