无法安装pyaudio,g

2024-04-26 23:05:47 发布

您现在位置:Python中文网/ 问答频道 /正文

正在尝试安装pyaudio,安装说明为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

我的装置怎么了?


Tags: installthefrompygitbuildsrcinclude
3条回答

很抱歉上次回答不恰当,我会把问题的答案贴出来。这可能对Ubuntu发行版有帮助。

  1. 首先我们需要安装portaudio模块:sudo apt-get install libasound-dev

  2. 从以下位置下载portaudio存档:http://portaudio.com/download.html

  3. 解压缩存档:tar -zxvf [portaudio.tgz]

  4. 输入目录,然后运行:./configure && make

  5. 安装:sudo make install

  6. 最后:sudo pip install pyaudio

  7. 检查pyaudio的版本,它应该是0.2.9

这对我有效:

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

在Ubuntu上:

sudo apt-get install python-pyaudio

或者

sudo apt-get install python3-pyaudio

相关问题 更多 >