PYTHON2 构建轮子 PyAudio 和 PortAudio 失败

PYTHON2 Failed building wheel PyAudio & PortAudio

我在 PyAudio 和 PortAudio 上遇到问题,我想使用 speech_recognition 所以 speech_recognition 需要 PyAudio 模块,我尝试安装但它不起作用我几乎搜索了所有内容 我正在使用 ParrotOS & Python 2.7.16.

所以我试过了;

pip install install clang

apt-get install & apt-get update 但那是行不通的

当我写控制台这段代码时;

sudo pip install portaudio

sudo pip install PyAudio

它向我展示了这个;

Collecting pyaudio
  Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (setup.py) ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-934KKj/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-tVvPhL --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  copying src/pyaudio.py -> build/lib.linux-x86_64-2.7
  running build_ext
  building '_portaudio' extension
  creating build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/src
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-UboFgi/python2.7-2.7.16~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-2.7/src/_portaudiomodule.o
  src/_portaudiomodule.c:29:10: fatal error: portaudio.h: No such file or directory
   #include "portaudio.h"
            ^~~~~~~~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for pyaudio
  Running setup.py clean for pyaudio
Failed to build pyaudio

以及更多失败消息。

sudo apt-get install portaudio19-dev
pip install pyaudio

后来我安装了pyaudio :)