我正在尝试在 Python 3.9 上安装 PyAudio。我正在运行 Windows 10 并使用 Ubuntu bash。 pip3 install
和 pip3 install pyasn‑1.6.0b1‑cp39‑cp39‑win_amd64.whl
我都试过了。第二个是尝试使用来自 here 的非官方 3.9 轮子。
这是我尝试 pip3 install pyaudio
时得到的结果:
Collecting pyaudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Building wheels for collected packages: pyaudio
Building wheel for pyaudio (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-imufkwd7/pyaudio/setup.py'"'"'; __file__='"'"'/tmp/pip-install-imufkwd7/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/pip-wheel-c2o57hhw
cwd: /tmp/pip-install-imufkwd7/pyaudio/
Complete output (16 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
copying src/pyaudio.py -> build/lib.linux-x86_64-3.8
running build_ext
building '_portaudio' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/src
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.8/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: portaudio.h: No such file or directory
29 | #include "portaudio.h"
| ^~~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: 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
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-imufkwd7/pyaudio/setup.py'"'"'; __file__='"'"'/tmp/pip-install-imufkwd7/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-record-8vw48w5x/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/lukangel00/.local/include/python3.8/pyaudio
cwd: /tmp/pip-install-imufkwd7/pyaudio/
Complete output (16 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
copying src/pyaudio.py -> build/lib.linux-x86_64-3.8
running build_ext
building '_portaudio' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/src
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.8/src/_portaudiomodule.o
src/_portaudiomodule.c:29:10: fatal error: portaudio.h: No such file or directory
29 | #include "portaudio.h"
| ^~~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-imufkwd7/pyaudio/setup.py'"'"'; __file__='"'"'/tmp/pip-install-imufkwd7/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-record-8vw48w5x/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/lukangel00/.local/include/python3.8/pyaudio Check the logs for full command output.
在错误消息中,我注意到对 Python 3.8 的引用,但我没有。这是错误的一部分吗?
这就是我尝试 pip3 install pyasn‑1.6.0b1‑cp39‑cp39‑win_amd64.whl
时得到的结果:
ERROR: PyAudio-0.2.11-cp39-cp39-win_amd64.whl is not a supported wheel on this platform.
我已经检查过了,我确定我有 x64 Python。我还尝试了一个不同的版本,以防这个版本有问题。
有什么想法吗?
答案 0 :(得分:0)
尝试安装 python-dev
sudo apt-get install python-dev