我在gitbash中使用pip安装了最新版本的opusforpython3.4

$ 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.

最佳答案

查看C:\ Python34\lib\site packages\opuslib\api文件夹中的__init.py__,第20行。它检查计算机中是否安装了opus,结果是找不到“opus库”。您只需pip安装python的opuslib,opus库的python绑定。在你的机器上安装opus。如果您正在使用mac,请尝试brew install opus

10-08 17:01