【问题标题】:How do I import rubberband after successful installation with pip and pip3?pip和pip3安装成功后如何导入橡皮筋?
【发布时间】: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 一起安装。

【问题讨论】:

  • 你安装了libsampleratelibsndfile
  • 谢谢 Tharun,我尝试安装依赖项,但仍然无法正常工作。我编辑了主要帖子以包含我尝试的各种方法的错误消息。
  • 迈克尔,首先,我提到了libsamplerate,而不是librubberband。其次,您必须使用 brew formulae.brew.sh/formula/libsndfile formulae.brew.sh/formula/libsamplerate 安装它们
  • libsamplerate 和 libsndfile 的 brew 安装成功了!非常感谢!

标签: python python-3.x audio librosa


【解决方案1】:

你可以试试解决办法:

来源:https://github.com/bmcfee/pyrubberband/issues/18#issuecomment-786515163

  1. 下载橡皮筋库(包含rubberband.exe和libsndfile-1.dll的文件夹
  2. 转到 Windows 系统环境并将文件夹添加到路径
  3. 创建系统变量,变量名为“rubberband”,路径为rubberband.exe
  4. 确保所有相关用户都可以访问路径和橡皮筋变量(对我来说,我必须为管理员帐户和本地用户帐户设置它)。这可以通过打开 cmd 并输入“rubberband”来检查。如果该命令有效,则该库被识别。
  5. 重新启动要在其中访问库的程序(例如重新启动 Visual Studio)

【讨论】:

  • OP 在 macOS 上,而不是在 Windows 上
  • 正确,我在 mac 而不是 windows。谢谢 jakub
  • 我现在明白 pyrubberband 是橡皮筋 (c/c++) 的 python 包装器。现在我遇到的问题是:“无法执行橡皮筋。请验证是否安装了橡皮筋。”
【解决方案2】:

问题的答案是用 brew 安装 pyrubberband,而不是 pip。

【讨论】:

    猜你喜欢
    • 2014-06-15
    • 1970-01-01
    • 1970-01-01
    • 2010-09-30
    • 1970-01-01
    • 2013-12-24
    • 2019-09-05
    • 2011-01-28
    • 1970-01-01
    相关资源
    最近更新 更多