安装PyAudio错误踩坑

First Post:

Last Update:

Word Count:
166

Read Time:
1 min

Page View: loading...

问题

在执行安装pyaudio时出现错误

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Collecting pyaudio
Using cached PyAudio-0.2.14.tar.gz (47 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyaudio
error: subprocess-exited-with-error

× Building wheel for pyaudio (pyproject.toml) did not run successfully.
exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
Building wheel for pyaudio (pyproject.toml) ... error
ERROR: Failed building wheel for pyaudio
Failed to build pyaudio
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pyaudio)

解决

在搜了好几个教程(CSDN和Stack OverFlow)之后发现是依赖库问题(PyAudio编译阶段问题)

1
sudo apt install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0

安装依赖库后就可以执行安装命令了