简体   繁体   中英

Can't install pyaudio at python 2.7 on MacOS

I typed: pip install pyaudio and then it says:

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/wj/x_g39c7n4pn_mrmpq2m35b0c0000gn/T/pip-install-vpovlb7i/pyaudio/setup.py'"'"'; __file__='"'"'/private/var/folders/wj/x_g39c7n4pn_mrmpq2m35b0c0000gn/T/pip-install-vpovlb7i/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/wj/x_g39c7n4pn_mrmpq2m35b0c0000gn/T/pip-record-ek_hs7p1/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/wj/x_g39c7n4pn_mrmpq2m35b0c0000gn/T/pip-install-vpovlb7i/pyaudio/
    Complete output (16 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
    src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
    #include "portaudio.h"
             ^~~~~~~~~~~~~
    1 error generated.
    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/wj/x_g39c7n4pn_mrmpq2m35b0c0000gn/T/pip-install-vpovlb7i/pyaudio/setup.py'"'"'; __file__='"'"'/private/var/folders/wj/x_g39c7n4pn_mrmpq2m35b0c0000gn/T/pip-install-vpovlb7i/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/wj/x_g39c7n4pn_mrmpq2m35b0c0000gn/T/pip-record-ek_hs7p1/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.
WARNING: You are using pip version 20.1.1; however, version 20.2 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -m pip install --upgrade pip' command.

This is being installed under python3, So I would recommend you to run this under a virtual environment https://help.dreamhost.com/hc/en-us/articles/215489338-Installing-and-using-virtualenv-with-Python-2 , then try trying this back again while venv being activated

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM