amazon

15.11.17

Installing pyaudio onto python 3 Anaconda on Mac

Anacondaのpython3にpyaudioをインストールした時のメモ。

$ python -m pip install pyaudio
で、
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
&nsbp;&nsbp;&nsbp;&nsbp;&nsbp;^
1 error generated.
error: command 'gcc' failed with exit status 1
と出た。

Then, I installed portaudio with brew.
$ brew install portaudio

But,
$ python -m pip install pyaudio
で、
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^
1 error generated.
error: command 'gcc' failed with exit status 1
Error again.

そこでThus, I passed an include path to pip,
$ python -m pip install --global-option=build_ext --global-option="-I/usr/local/include/" pyaudio

今回はThis time,
ld: library not found for -lportaudio
portaudio libiraryがないと出た。

最終的にFinally, I did,
$ export LIBRARY_PATH="/usr/local/lib"
$python -m pip install --global-option=build_ext --global-option="-I/usr/local/include/" pyaudio
I have got,
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... done
Successfully installed pyaudio-0.2.11