首先安装依赖库,不安装依赖库会安装失败:
sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0
然后,就可以直接
pip install pyaudio