pip install pyaudio安装报错ERROR: Failed building wheel for pyaudio解决
PyAudio
PyAudio 为跨平台音频 I/O 库 PortAudio 提供 Python 绑定。借助 PyAudio,您可以轻松地使用 Python 在各种平台上播放和录制音频,例如 GNU/Linux、Microsoft Windows 和 Apple macOS。
报错Failed building wheel for pyaudio
安装pip install pyaudio时,报错:
ERROR: Failed building wheel for pyaudio
Building wheel for pyaudio (pyproject.toml) … error
error: subprocess-exited-with-error
Failed to build pyaudio
ERROR: Failed to build installable wheels for some pyproject.toml based projects (pyaudio)
无法为pyaudio生成轮子,因为未安装程序包’wheel‘
错误:无法为py音频构建轮子,这是安装pyproject.toml项目所必需的
由于未安装软件包“wheel”,无法为pyaudio构建轮子
错误:无法为pyaudio构建轮,这是安装基于pyproject.toml的项目所需的
错误:无法在Python中为 pyaudio 构建轮子
ERROR: Could not build wheels for pyaudio in Python
完整报错信息如下:
PS C:\Users\easyb\Desktop\test>
>> pip install PyAudio
Defaulting to user installation because normal site-packages is not writeable
Collecting PyAudioUsing cached 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╰─> [9 lines of output]WARNING:root:Warning: VCPKG_PATH envrionment variable not set.INFO:root:running bdist_wheelINFO:root:running buildINFO:root:running build_pyINFO:root:creating build\lib.win-amd64-cpython-313\pyaudioINFO:root:copying src\pyaudio\__init__.py -> build\lib.win-amd64-cpython-313\pyaudioINFO:root:running build_extINFO:root:building 'pyaudio._portaudio' extensionerror: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/[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
解决
网上资料下载链接https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio已经失效The page you requested was removed.
花了些时间搜集,并在这里上传。
上传wheel版本如下,可在绑定资源下载:
PyAudio-0.2.13-cp310-cp310-linux_x86_64.whl
PyAudio-0.2.13-cp310-cp310-macosx_11_0_x86_64.whl
PyAudio-0.2.13-cp310-cp310-win_amd64.whl
PyAudio-0.2.13-cp311-cp311-linux_x86_64.whl
PyAudio-0.2.13-cp311-cp311-macosx_10_9_universal2.whl
PyAudio-0.2.13-cp311-cp311-win_amd64.whl
PyAudio-0.2.14-cp310-cp310-linux_x86_64.whl
PyAudio-0.2.14-cp310-cp310-macosx_10_9_universal2.whl
PyAudio-0.2.14-cp310-cp310-macosx_11_0_x86_64.whl
PyAudio-0.2.14-cp310-cp310-macosx_12_0_x86_64.whl
PyAudio-0.2.14-cp310-cp310-win_amd64.whl
PyAudio-0.2.14-cp311-cp311-linux_x86_64.whl
PyAudio-0.2.14-cp311-cp311-macosx_10_9_universal2.whl
PyAudio-0.2.14-cp311-cp311-win_amd64.whl
PyAudio-0.2.14-cp312-cp312-linux_x86_64.whl
PyAudio-0.2.14-cp312-cp312-macosx_10_13_universal2.whl
PyAudio-0.2.14-cp312-cp312-macosx_10_9_universal2.whl
PyAudio-0.2.14-cp312-cp312-win_amd64.whl
PyAudio-0.2.14-cp313-cp313-linux_x86_64.whl
PyAudio-0.2.14-cp313-cp313-macosx_10_13_universal2.whl
下载:上述内容均在压缩包内,适用PYTHON3.10,PYTHON3.11,PYTHON3.12版本,选择对应的CP310,CP311,CP312即可,选择时请按自己的操作系统选择,并先安装对应的PYTHON版本。
示例
wheel文件拷贝到Scripts文件夹,执行:
pip install C:\Users\easyb\AppData\Local\Programs\Python\Python312\Scripts\PyAudio-0.2.14-cp312-cp312-win_amd64.whl
文件夹为PIP路径,文件名同你选择的WHEEL文件。
上述适用WINDOWS版本,并安装PYTHON3.12。