Cannot install pyaudio, gcc error

橙三吉。 提交于 2019-11-27 05:37:09

问题


Trying to install pyaudio with instructions per here:

$ git clone http://people.csail.mit.edu/hubert/git/pyaudio.git
$ cd pyaudio
$ sudo python setup.py install
running install
running build
running build_py
running build_ext
building '_portaudio' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-2.7/src/_portaudiomodule.o
In file included from /usr/include/python2.7/Python.h:8:0,
                 from src/_portaudiomodule.c:28:
/usr/include/python2.7/pyconfig.h:1161:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/usr/include/features.h:215:0: note: this is the location of the previous definition
src/_portaudiomodule.c:29:23: fatal error: portaudio.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

What's going wrong in my installation?


回答1:


Sorry about the inappropriate answer last time, I will post the solution of the question. It might be helpful for Ubuntu distributions.

  1. First we need to install portaudio modules: sudo apt-get install libasound-dev

  2. Download the portaudio archive from: http://portaudio.com/download.html

  3. Unzip the archive: tar -zxvf [portaudio.tgz]

  4. Enter the directory, then run: ./configure && make

  5. Install: sudo make install

  6. And finally: sudo pip install pyaudio

  7. Check the version of pyaudio, it should be 0.2.9




回答2:


On Ubuntu:

sudo apt-get install python-pyaudio

or

sudo apt-get install python3-pyaudio



回答3:


This worked for me:

sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0
sudo apt-get install ffmpeg libav-tools
sudo pip install pyaudio



回答4:


For Centos7:

sudo yum install -y portaudio-devel
sudo pip install pyaudio



回答5:


step1:

sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0

step 2:-

pip install pyaudio --user



回答6:


For Windows :

Install using pip:

 python -m pip install pyaudio

if pip is not already bundled with your installation of Python, get it here.

For Mac OS X :

Use Homebrew to install the prerequisite portaudio library, then install PyAudio using pip:

 brew install portaudio
 pip install pyaudio

pip will download the PyAudio source and build it for your version of Python.

For Debian/Ubuntu :

Use the package manager to install PyAudio:

 sudo apt-get install python-pyaudio python3-pyaudio

If the latest version of PyAudio is not available, install it using pip:

pip install pyaudio

For better isolation from system packages, consider installing PyAudio in a virtual environment

PyAudio Source :

Source is available for download at the Python Package Index (PyPI): here!

Or clone the git repository:

git clone https://people.csail.mit.edu/hubert/git/pyaudio.git

credits: PyAudio and GitHub:Speech_Recognition




回答7:


  • First we need to install portaudio modules: sudo apt-get install libasound-dev
  • Download the portaudio archive from: http://portaudio.com/download.html

  • Unzip the archive: tar -zxvf [portaudio.tgz]

  • Enter the directory, then run: ./configure && make

  • Install: sudo make install

  • And finally: sudo pip install pyaudio

  • Check the version of pyaudio, it should be 0.2.9



来源:https://stackoverflow.com/questions/20023131/cannot-install-pyaudio-gcc-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!