本文介绍了通过在我的 Raspberry pi 3 (noobs) 上安装 PyAudio (Python3) 我收到一个错误,我该如何解决这个问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

pip install pyaudio

Downloading/unpacking pyaudio

  Downloading PyAudio-0.2.11.tar.gz

  Running setup.py (path:/tmp/pip-build-u0HEK5/pyaudio/setup.py) egg_info for package pyaudio

Installing collected packages: pyaudio

  Running setup.py install for pyaudio

building '_portaudio' extension

arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-armv7l-2.7/src/_portaudiomodule.o
src/_portaudiomodule.c:29:23: fatal error: portaudio.h: No such file or directory

 #include "portaudio.h"
                       ^
compilation terminated.

error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-u0HEK5/pyaudio/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-g5l7H9-record/install-record.txt --single-version-externally-managed --compile:

running install

running build

running build_py

creating build

creating build/lib.linux-armv7l-2.7

copying src/pyaudio.py -> build/lib.linux-armv7l-2.7

running build_ext

building '_portaudio' extension

creating build/temp.linux-armv7l-2.7

creating build/temp.linux-armv7l-2.7/src

arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-armv7l-2.7/src/_portaudiomodule.o

src/_portaudiomodule.c:29:23: fatal error: portaudio.h: No such file or directory

 #include "portaudio.h"

                       ^

compilation terminated.

error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

清理...


Cleaning up...

命令/usr/bin/python -c "import setuptools,tokenize;file='/tmp/pip-build-u0HEK5/pyaudio/setup.py';exec(compile(getattr(tokenize,'open', open)(file).read().replace('\r\n', '\n'), file,'exec'))" install --record/tmp/pip-g5l7H9-record/install-record.txt--single-version-externally-managed --compile failed with error code 1 in/tmp/pip-build-u0HEK5/pyaudio 存储调试日志失败/home/pi/.pip/pip.log

推荐答案

注意:这是安装的详细步骤,为了更快的安装,请考虑使用@Julian 的回答.

Note: this a Detailed steps for the installation, for faster installation please consider using @Julian's answer.

那是因为你没有适当的pyaudio"先决条件,端口音频头文件就是其中之一.

That is because you dont have proper prerequisites for the "pyaudio", and port audio header files are one of them.

所以首先安装先决条件,然后你的安装就会成功.在安装 pyaudio 之前先尝试以下命令.

so first install the prerequisites then your installation will succeed.try the below commands first before installing pyaudio.

sudo apt-get update

sudo apt-get install libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev

sudo apt-get install python-dev 

此后现在从下载的文件或从 git 存储库安装 pyaudio 安装

after this now install pyaudio installation either from downloaded file or from a git repository

sudo pip install pyaudio

sudo apt-get install git

sudo git clone http://people.csail.mit.edu/hubert/git/pyaudio.git

sudo git clone http://people.csail.mit.edu/hubert/git/pyaudio.git

cd pyaudio

sudo python setup.py install 

还有什么可以在下方留言.

anything else leave a comment below.

这篇关于通过在我的 Raspberry pi 3 (noobs) 上安装 PyAudio (Python3) 我收到一个错误,我该如何解决这个问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 16:45