尽管安装了Opus,但不会导入

时间:2016-05-14 01:12:12

标签: python python-3.x opus

我使用gitbash中的pip

为python 3.4安装了最新版本的opus
$ pip install --upgrade opuslib
Requirement already up-to-date: opuslib in c:\python34\lib\site-packages

尽管如此,当我尝试导入它时,我会接收到一个未安装的错误

import opuslib
import opuslib.api
import opuslib.api.encoder
import opuslib.api.decoder

...

    Traceback (most recent call last):
  File "E:\__Basic-discord-bot\bot.py", line 11, in <module>
    import opuslib
  File "C:\Python34\lib\site-packages\opuslib\__init__.py", line 26, in <module>
    from .classes import Encoder, Decoder  # NOQA
  File "C:\Python34\lib\site-packages\opuslib\classes.py", line 11, in <module>
    import opuslib.api.decoder
  File "C:\Python34\lib\site-packages\opuslib\api\__init__.py", line 20, in <module>
    'Could not find opus library. Make sure it is installed.')
Exception: Could not find opus library. Make sure it is installed.

2 个答案:

答案 0 :(得分:0)

查看C:\ Python34 \ lib \ site-packages \ opuslib \ api文件夹中的__init.py__,第20行。它检查您的机器中是否安装了opus,结果是,找不到& #39; opus library&#39;。你只需要安装python的opuslib,即opus库的python绑定。在您的机器中安装opus。如果您使用的是mac,请尝试brew install opus

答案 1 :(得分:0)

如果在mac上,我找到了Homebrew'lib'目录,继承我的python解释器:

@IBAction func myAction(_ sender: Any?) {
    guard let button = sender as? UIButton else { return }
    let buttonTitle = button.title(for: .normal)

    ...
}