无法安装pocketsphinx

问题描述

我在 Mac OS Big sur 上运行 Python 3.8.5。

问题源于我尝试使用 python 库 Speech_recognition。

来自 https://github.com/Uberi/speech_recognition代码示例包含以下内容,这会导致 RequestError,这是导入错误

try:
    print("Sphinx thinks you said " + r.recognize_sphinx(audio,language = 'it_IT'))
except sr.UnkNownValueError:
    print("Sphinx Could not understand audio")
except sr.RequestError as e:
    print("Sphinx error; {0}".format(e))

尝试使用 pip 安装模块 Pocketsphinx,我收到两个大错误,但在第一个块的末尾有这个:

  error: command 'gcc' Failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pocketsphinx

互联网上的任何搜索都会导致此解决方案(github:https://github.com/deanmalmgren/textract/issues/209,堆栈溢出:ERROR: Failed building wheel for pocketsphinx while trying to install pocketsphinx with pip):

sudo apt-get install -y python python-dev python-pip build-essential swig git libpulse-dev

pip install pocketsphinx

现在,我的理解是 apt-get 在 Mac OS X 上不可用。相反,您可以使用 brew。但是这些几乎没有一个可以用 brew 安装。

我试着跑:

brew install pocketsphinx

并且它安装了 cmu-pocketsphinx,但这对我在 python 中使用 pocketsphinx 没有帮助。

我还尝试了 https://pypi.org/project/pocketsphinx/ 上“安装开发版本”中的所有说明。

我什至尝试按照此处的说明修改 2 行 c 代码,但无济于事: https://github.com/MycroftAI/mycroft-precise/issues/75

如果没有pocketsphinx,就不可能使用,其中包括speech_recognition,所以我的问题是如何为python安装pocketsphinx

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)