简体   繁体   English

通过在我的Raspberry pi 3(noobs)上安装PyAudio(Python3),我得到一个错误,我该如何解决?

[英]by installing PyAudio (Python3) on my Raspberry pi 3 (noobs) I get an error, how could i fix this?

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... 打扫干净...

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 failed with error code 1 in /tmp/pip-build-u0HEK5/pyaudio Storing debug log for failure in /home/pi/.pip/pip.log 命令/ 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'))“安装--record /tmp/pip-g5l7H9-record/install-record.txt --single -version-外部管理--编译失败,错误代码为/ tmp / pip-build-u0HEK5 / pyaudio在/home/pi/.pip/pip.log中存储调试日志

Note: this a Detailed steps for the installation, for faster installation please consider using @Julian's answer. 注意:这是安装的详细步骤,为加快安装速度,请考虑使用@Julian的答案。

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. 在安装pyaudio之前,请先尝试以下命令。

sudo apt-get update

sudo apt-get install libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev

sudo apt-get install python-dev 

after this now install pyaudio installation either from downloaded file or from a git repository 在此之后现在从下载的文件或git存储库安装pyaudio安装

sudo pip install pyaudio

or 要么

sudo apt-get install git

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

cd pyaudio

sudo python setup.py install 

anything else leave a comment below. 其他任何事情请在下面发表评论。

This is related to Pyaudio installation error - 'command 'gcc' failed with exit status 1' 这与Pyaudio安装错误有关-'命令'gcc'失败,退出状态为1'

Try the same solution: 尝试相同的解决方案:

sudo apt-get install python-pyaudio

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM