You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MacOS Intel芯片环境下安装PyAudio失败的问题求助

MacOS Intel芯片环境下安装PyAudio失败的问题求助

我在运行命令 pip3 install pyaudio 时遇到了如下错误:

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
Building wheel for pyaudio (pyproject.toml) ... error
error: subprocess-exited-with-error

× Building wheel for pyaudio (pyproject.toml) did not run 
successfully.
 │ exit code: 1
 ╰─> [18 lines of output]
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-x86_64-cpython-38
  creating build/lib.macosx-10.9-x86_64-cpython-38/pyaudio
  copying src/pyaudio/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-38/pyaudio
  running build_ext
  building 'pyaudio._portaudio' extension
  creating build/temp.macosx-10.9-x86_64-cpython-38
  creating build/temp.macosx-10.9-x86_64-cpython-38/src
  creating build/temp.macosx-10.9-x86_64-cpython-38/src/pyaudio
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOS=1 -I/usr/local/include -I/usr/include -I/opt/homebrew/include "-I<PATH FROM STEP 3>/include/" -I/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c src/pyaudio/device_api.c -o build/temp.macosx-10.9-x86_64-cpython-38/src/pyaudio/device_api.o
  src/pyaudio/device_api.c:9:10: fatal error: 'portaudio.h' file not found
  #include "portaudio.h"
           ^~~~~~~~~~~~~
  1 error generated.
  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

我当前使用的是MacOS 14.3.1系统(Intel芯片),有没有解决这个问题的建议?

备注:内容来源于stack exchange,提问作者Benny Mestel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.17 12:48:02