我正在尝试在 Ubuntu Mate 中安装 pyaudio pip3 install pyaudio
。但是我收到错误。如何修复该错误?
Collecting pyaudio
Downloading https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Building wheels for collected packages: pyaudio
Running setup.py bdist_wheel for pyaudio ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-sdstw2l2/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpxh6_2az5pip-wheel- --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-i686-3.6
copying src/pyaudio.py -> build/lib.linux-i686-3.6
running build_ext
building '_portaudio' extension
creating build/temp.linux-i686-3.6
creating build/temp.linux-i686-3.6/src
i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c src/_portaudiomodule.c -o build/temp.linux-i686-3.6/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: portaudio.h: No such file or directory
#include "portaudio.h"
^~~~~~~~~~~~~
compilation terminated.
error: command 'i686-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for pyaudio
Running setup.py clean for pyaudio
Failed to build pyaudio
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-sdstw2l2/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-tccnyizi-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
running install
running build
running build_py
creating build
creating build/lib.linux-i686-3.6
copying src/pyaudio.py -> build/lib.linux-i686-3.6
running build_ext
building '_portaudio' extension
creating build/temp.linux-i686-3.6
creating build/temp.linux-i686-3.6/src
i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c src/_portaudiomodule.c -o build/temp.linux-i686-3.6/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: portaudio.h: No such file or directory
#include "portaudio.h"
^~~~~~~~~~~~~
compilation terminated.
error: command 'i686-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-sdstw2l2/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-tccnyizi-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-sdstw2l2/pyaudio/
答案1
从https://github.com/HackerShackOfficial/AI-Smart-Mirror/issues/23
sudo apt-get 安装 portaudio19-dev
pip3 安装 pyaudio