我正在尝试在 Mac 上安装 pyaudio 并收到以下错误

时间:2021-04-17 07:07:11

标签: python xcode gcc pyaudio portaudio

% pip3 安装 pyaudio 收集pyaudio 使用缓存的 PyAudio-0.2.11.tar.gz (37 kB) 对 pyaudio 使用旧版“setup.py install”,因为未安装包“wheel”。 安装收集的软件包:pyaudio 为 pyaudio 运行 setup.py install ... 错误 错误:命令出错,退出状态为 1: 命令:/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/41/jq1tn1b113b6nmbmpqqfxhrr0000gn/T/pip-install-yuqomyva/pyaudio_df9e48fd3dc447b18c59302d7aac.uppy'";"; file='"'"'/private/var/folders/41/jq1tn1b113b6nmbmpqqfxhrr0000gn/T/pip-install-yuqomyva/pyaudio_df9e48fd3dc447b18c59302d7aac4fe2"f '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/41/jq1tn1b113b6nmbmpqqfxhrr0000gn/T/pip-record-kg79q2az/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python .framework/Versions/3.9/include/python3.9/pyaudio cwd:/private/var/folders/41/jq1tn1b113b6nmbmpqqfxhrr0000gn/T/pip-install-yuqomyva/pyaudio_df9e48fd3dc447b18c59302d7aac4fe2/ 完整输出(16 行): 运行安装 运行构建 运行 build_py 创建构建 创建 build/lib.macosx-10.9-x86_64-3.9 复制 src/pyaudio.py -> build/lib.macosx-10.9-x86_64-3.9 运行 build_ext 构建“_portaudio”扩展 创建 build/temp.macosx-10.9-x86_64-3.9 创建 build/temp.macosx-10.9-x86_64-3.9/src gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOSX=1 -I/Library/Frameworks/Python.framework /Versions/3.9/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-3.9/src/_portaudiomodule.o src/_portaudiomodule.c:29:10: 致命错误:找不到“portaudio.h”文件 #include "portaudio.h" ^~~~~~~~~~~~~ 产生了 1 个错误。 错误:命令“/usr/bin/gcc”失败,退出代码为 1 --------------------------- 错误:命令出错,退出状态为 1:/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/41/jq1tn1b113b6nmbmpqqfxhrr0000gn/T/pip-install-yuqomyva/pyaudio_df9e48fd3dc447b18c59302d7aac.uppy'";"; file='"'"'/private/var/folders/41/jq1tn1b113b6nmbmpqqfxhrr0000gn/T/pip-install-yuqomyva/pyaudio_df9e48fd3dc447b18c59302d7aac4fe2"f '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/41/jq1tn1b113b6nmbmpqqfxhrr0000gn/T/pip-record-kg79q2az/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python .framework/Versions/3.9/include/python3.9/pyaudio 检查日志以获取完整的命令输出。

1 个答案:

答案 0 :(得分:0)

试试:

pip install pipwin

还有:

pipwin install pyaudio

希望能帮到你:D