一.环境搭建
1.首先,下载speech recognition,可pip install speech recognition,如果感觉下载慢,可以用镜像pip install SpeechRecognition -i https://mirror.baidu.com/pypi/simple下载。
2.在下载pyaudio时,需要先下载portaudio,这里有两种方法
1.brew install portaudio
pip install pyaudio(注意顺序)
2.pip install pipwin
pipwin install pyaudio
如果直接 pip install pyaudio,则会出现这种错误:
error: command 'gcc' failed with exit status 1(关键句)
3.下载PocketSphinx
用pip install PocketSphinx
4.下载PocketSphinx中文模块
在http://sourceforge.net/projects/cmusphinx/files/Acoustic%20and%20Language%20Models/
在mandarin 中下载