wget http://www.portaudio.com/archives/pa_stable_v19_20140130.tgz
tar xf pa_stable_v19_20140130.tgz
cd portaudio/
./configure
make
sudo make install
sudo nano ~/.bashrc
  • Then add these codes into the latest line in the ~/.bashrc.
LD_LIBRARY_PATH="/usr/local/lib"
export LD_LIBRARY_PATH
LD_RUN_PATH="/usr/local/lib"
export LD_RUN_PATH
PATH=$PATH:/usr/local/lib/
export PATH
  • After adding those lines into the ~/.bashrc reboot the Raspberry PI.
  • Then install PyAudio using pip.
sudo pip install pyaudio
sudo pip3 install pyaudio