无法在 Ubuntu 21.04 上安装 pyaudio?
Unable to install pyaudio on Ubuntu 21.04?
在 python venv
中通过终端我尝试使用 pip install pyaudio
安装 pyaudio。我继续收到以下错误:
Collecting pyaudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Using legacy 'setup.py install' for pyaudio, since package 'wheel' is not installed.
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
ERROR: Command errored out with exit status 1:
command: /home/user/Documents/Dev/jarvis/venv/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-n_fu8__5/pyaudio_a1072b1cc7344f699b51f2cf840e0e1f/setup.py'"'"'; __file__='"'"'/tmp/pip-install-n_fu8__5/pyaudio_a1072b1cc7344f699b51f2cf840e0e1f/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-record-mnx7j3d4/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/Documents/Dev/jarvis/venv/include/site/python3.9/pyaudio
cwd: /tmp/pip-install-n_fu8__5/pyaudio_a1072b1cc7344f699b51f2cf840e0e1f/
Complete output (16 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
copying src/pyaudio.py -> build/lib.linux-x86_64-3.9
running build_ext
building '_portaudio' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/src
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-1n6GrT/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-1n6GrT/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/user/Documents/Dev/jarvis/venv/include -I/usr/include/python3.9 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.9/src/_portaudiomodule.o
src/_portaudiomodule.c:28:10: fatal error: Python.h: No such file or directory
28 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/user/Documents/Dev/jarvis/venv/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-n_fu8__5/pyaudio_a1072b1cc7344f699b51f2cf840e0e1f/setup.py'"'"'; __file__='"'"'/tmp/pip-install-n_fu8__5/pyaudio_a1072b1cc7344f699b51f2cf840e0e1f/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-record-mnx7j3d4/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/Documents/Dev/jarvis/venv/include/site/python3.9/pyaudio Check the logs for full command output.
在您的终端中尝试 pip install wheel
并再次尝试安装 pyaudio
在 python venv
中通过终端我尝试使用 pip install pyaudio
安装 pyaudio。我继续收到以下错误:
Collecting pyaudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Using legacy 'setup.py install' for pyaudio, since package 'wheel' is not installed.
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
ERROR: Command errored out with exit status 1:
command: /home/user/Documents/Dev/jarvis/venv/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-n_fu8__5/pyaudio_a1072b1cc7344f699b51f2cf840e0e1f/setup.py'"'"'; __file__='"'"'/tmp/pip-install-n_fu8__5/pyaudio_a1072b1cc7344f699b51f2cf840e0e1f/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-record-mnx7j3d4/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/Documents/Dev/jarvis/venv/include/site/python3.9/pyaudio
cwd: /tmp/pip-install-n_fu8__5/pyaudio_a1072b1cc7344f699b51f2cf840e0e1f/
Complete output (16 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
copying src/pyaudio.py -> build/lib.linux-x86_64-3.9
running build_ext
building '_portaudio' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/src
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-1n6GrT/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-1n6GrT/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/user/Documents/Dev/jarvis/venv/include -I/usr/include/python3.9 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.9/src/_portaudiomodule.o
src/_portaudiomodule.c:28:10: fatal error: Python.h: No such file or directory
28 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/user/Documents/Dev/jarvis/venv/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-n_fu8__5/pyaudio_a1072b1cc7344f699b51f2cf840e0e1f/setup.py'"'"'; __file__='"'"'/tmp/pip-install-n_fu8__5/pyaudio_a1072b1cc7344f699b51f2cf840e0e1f/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-record-mnx7j3d4/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/Documents/Dev/jarvis/venv/include/site/python3.9/pyaudio Check the logs for full command output.
在您的终端中尝试 pip install wheel
并再次尝试安装 pyaudio