Python 我能';t在Mac上安装PyAudio

Python 我能';t在Mac上安装PyAudio,python,pyaudio,Python,Pyaudio,这是终端线路: pip install pyaudio Collecting pyaudio Using cached PyAudio-0.2.11.tar.gz (37 kB) Using legacy 'setup.py install' for pyaudio, since package 'wheel' is not installed. Installing collected packages: pyaudio Running setup.py install for p

这是终端线路:

pip install pyaudio
Collecting pyaudio
  Using cached PyAudio-0.2.11.tar.gz (37 kB)
Using legacy 'setup.py install' for pyaudio, since package 'wheel' is not installed.
Installing collected packages: pyaudio
    Running setup.py install for pyaudio ... error
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/mt/2rtm41zn26x_6nxfh29s9g9w0000gn/T/pip-install-vnh5uil7/pyaudio/setup.py'"'"'; __file__='"'"'/private/var/folders/mt/2rtm41zn26x_6nxfh29s9g9w0000gn/T/pip-install-vnh5uil7/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/mt/2rtm41zn26x_6nxfh29s9g9w0000gn/T/pip-record-53bfxokf/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/pyaudio
         cwd: /private/var/folders/mt/2rtm41zn26x_6nxfh29s9g9w0000gn/T/pip-install-vnh5uil7/pyaudio/
    Complete output (13 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.8
    copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-3.8
    running build_ext
    building '_portaudio' extension
    creating build/temp.macosx-10.9-x86_64-3.8
    creating build/temp.macosx-10.9-x86_64-3.8/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.8/include/python3.8 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-3.8/src/_portaudiomodule.o
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/mt/2rtm41zn26x_6nxfh29s9g9w0000gn/T/pip-install-vnh5uil7/pyaudio/setup.py'"'"'; __file__='"'"'/private/var/folders/mt/2rtm41zn26x_6nxfh29s9g9w0000gn/T/pip-install-vnh5uil7/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/mt/2rtm41zn26x_6nxfh29s9g9w0000gn/T/pip-record-53bfxokf/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/pyaudio Check the logs for full command output.

我从brew安装了端口音频。

这里有一个线程,希望能帮助您:


-->

更新
xcrun
的命令行工具-请参阅使用brew: