1
votes

I have visited many forums, tried diffrent methods like brew, pip, port and many more but still am facing the same error.

View this Image for more detail

src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
    #include "portaudio.h"
             ^~~~~~~~~~~~~
    1 error generated.
    error: command '/usr/bin/gcc' failed with exit code 1

Can anyone help?

1

1 Answers

1
votes

This Solution is tested on M1 Macs[Please do check with other].

After the installation of HomeBrew on your system, perform the installation of PortAudio. Next follow the steps mentioned below:

Use the command to install PortAudio

sudo brew install portaudio

After successful installation of PortAudio, enter the following command.

sudo nano $HOME/.pydistutils.cfg

Next, enter the following lines in the opened window

[build_ext]
include_dirs=/Users/<enter-your-system-username>/homebrew/Cellar/portaudio/19.20140130/include/
include_dirs=/Users/<enter-your-system-username>/homebrew/Cellar/portaudio/19.20140130/lib/

Note: PortAudio location may be different for you and also don't forget to replace your PC username.

Finally run the command

pip install pyaudio

or

pip3 install pyaudio