gpt4 book ai didi

python-3.x - 在 Raspberry pi 3 上安装 PyAudio 失败并出现 gcc 错误

转载 作者:行者123 更新时间:2023-12-01 22:54:07 26 4
gpt4 key购买 nike

我尝试使用 pip install pyaudio 在我的 Raspbery Pi 3 上安装 PyAudio,但出现以下错误:

compilation terminated.

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

以下是完整日志:

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

最佳答案

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

这是因为您没有“pyaudio”的适当先决条件,而端口音频头文件就是其中之一。

因此,首先安装先决条件,然后安装就会成功。在安装 pyaudio 之前先尝试以下命令。

sudo apt-get update

sudo apt-get install libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev

sudo apt-get install python-dev

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

sudo pip install pyaudio

sudo apt-get install git

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

cd pyaudio

sudo python setup.py install

还有什么想说的请在下面留言。

关于python-3.x - 在 Raspberry pi 3 上安装 PyAudio 失败并出现 gcc 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48135955/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com