Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

when installing pyaudio, pip cannot find portaudio.h in /usr/local/include

I'm using mac osx 10.10 As the PyAudio Homepage said, I install the PyAudio using

brew install portaudio  pip install pyaudio 

the installation of portaudio seems successful, I can find headers and libs in /usr/local/include and /usr/local/lib but when I try to install pyaudio, it gives me an error that

src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found #include "portaudio.h"          ^ 1 error generated. error: command 'cc' failed with exit status 1 

actually it is in /usr/local/include why can't it find the file? some answers to similar questions are not working for me(like using virtualenv, or compile it manually), and I want to find a simple way to solve this.

like image 308
Xun Jian Avatar asked Nov 04 '15 04:11

Xun Jian


People also ask

What is Portaudio H?

PortAudio is a free, cross-platform, open-source, audio I/O library. It lets you write simple audio programs in 'C' or C++ that will compile and run on many platforms including Windows, Macintosh OS X, and Unix (OSS/ALSA).


1 Answers

Since pyAudio has portAudio as a dependency, you first have to install portaudio.

brew install portaudio 

Then try: pip install pyAudio. If the problem persists after installing portAudio, you can specify the directory path where the compiler will be able to find the source programs (e.g: portaudio.h). Since the headers should be in the /usr/local/include directory:

pip install --global-option='build_ext' --global-option='-I/usr/local/include' --global-option='-L/usr/local/lib' pyaudio 
like image 147
fukudama Avatar answered Sep 21 '22 13:09

fukudama