安装pyaudio
$ sudo apt install python-pyaudio
$ sudo apt install git
$ git clone http://people.csail.mit.edu/hubert/git/pyaudio.git
$ sudo apt install libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev
$ sudo apt install python-dev
然后
$ cd pyaudio
$ sudo python3 setup.py install
树莓派录放音频参考: