【发布时间】:2021-05-06 14:52:09
【问题描述】:
我正在尝试使用橡皮筋,但遇到了以前从未见过的错误,也不知道如何解决。
首先,我通过终端安装了 pip 和 pip3。橡皮筋出现在 pip freeze 和 pip3 freeze 为 0.2.0 版本。
在终端导入橡皮筋python编辑器时,返回常见错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named rubberband
当我在终端导入橡皮筋python3编辑器时,返回异常错误。 (在jupyter notebook中导入时也会出现这个错误):
>>> import rubberband
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/rubberband.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/lib/libsndfile.1.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/rubberband.cpython-37m-darwin.so
Reason: image not found
我认为值得注意的是,python 和 python3 中的 import 返回不同的错误消息。从那里开始,我遇到了故障排除问题。
提前致谢!
编辑:Tharun K 评论检查依赖项:librubberband 和 libsndfile。以下是尝试安装 librubberband 时返回的错误消息。 (同样的错误适用于 libsndfile)
$ pip3 install librubberband
ERROR: Could not find a version that satisfies the requirement librubberband (from versions: none)
ERROR: No matching distribution found for librubberband
$ python3 -m pip install "librubberband==1.8"
ERROR: Could not find a version that satisfies the requirement librubberband==1.8 (from versions: none)
ERROR: No matching distribution found for librubberband==1.8
$ python3 -m pip install "librubberband~=1.8"
ERROR: Could not find a version that satisfies the requirement librubberband~=1.8 (from versions: none)
ERROR: No matching distribution found for librubberband~=1.8
编辑 2:来自 Tharun K 的解决方案 “Michael,首先,我提到了 libsamplerate 和 libsndfil formulae.brew.sh/formula/libsndfile formulae.brew.sh/formula/libsamplerate – Tharun K "
libsamplerate 和 libsndfil 需要与 brew 一起安装。
【问题讨论】:
-
你安装了
libsamplerate和libsndfile -
谢谢 Tharun,我尝试安装依赖项,但仍然无法正常工作。我编辑了主要帖子以包含我尝试的各种方法的错误消息。
-
迈克尔,首先,我提到了
libsamplerate,而不是librubberband。其次,您必须使用 brew formulae.brew.sh/formula/libsndfile formulae.brew.sh/formula/libsamplerate 安装它们 -
libsamplerate 和 libsndfile 的 brew 安装成功了!非常感谢!
标签: python python-3.x audio librosa