本文主要是介绍错误:ERROR: Failed building wheel for pyaudio,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
问题描述
安装pyaudio的时候报错
$ pip install pyaudio
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pyaudioUsing cached https://pypi.tuna.tsinghua.edu.cn/packages/26/1d/8878c7752febb0f6716a7e1a52cb92ac98871c5aa522cba181878091607c/PyAudio-0.2.14.tar.gz (47 kB)Installing build dependencies ... doneGetting requirements to build wheel ... donePreparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyaudioBuilding wheel for pyaudio (pyproject.toml) ... errorerror: subprocess-exited-with-error× Building wheel for pyaudio (pyproject.toml) did not run successfully.│ exit code: 1╰─> [18 lines of output]running bdist_wheelrunning buildrunning build_pycreating buildcreating build/lib.linux-x86_64-cpython-38creating build/lib.linux-x86_64-cpython-38/pyaudiocopying src/pyaudio/__init__.py -> build/lib.linux-x86_64-cpython-38/pyaudiorunning build_extbuilding 'pyaudio._portaudio' extensioncreating build/temp.linux-x86_64-cpython-38creating build/temp.linux-x86_64-cpython-38/srccreating build/temp.linux-x86_64-cpython-38/src/pyaudiogcc -pthread -B /home/dev/anaconda3/envs/38/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -I/usr/include -I/home/dev/anaconda3/envs/38/include/python3.8 -c src/pyaudio/device_api.c -o build/temp.linux-x86_64-cpython-38/src/pyaudio/device_api.osrc/pyaudio/device_api.c:9:10: fatal error: portaudio.h: 没有那个文件或目录9 | #include "portaudio.h"| ^~~~~~~~~~~~~compilation terminated.error: command '/usr/bin/gcc' failed with exit code 1[end of output]note: This error originates from a subprocess, and is likely not a problem with pip.ERROR: Failed building wheel for pyaudio
Failed to build pyaudio
ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects
解决方案1
安装对应的依赖
$ sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0 -y
$ pip install pyaudio
解决方案2(windows)
选择下载合适的pyaudio包的.whl文件
这篇关于错误:ERROR: Failed building wheel for pyaudio的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!