简体   繁体   English

在 macOS 中安装 PyAudio 时出错:如何解决此问题?

[英]Error While installing PyAudio in macOS: How can I fix this problem?

I was trying to install PyAudio The system is macOS Mojave, and version of Python is 3.8我正在尝试安装 PyAudio 系统是 macOS Mojave,Python 版本是 3.8

I think pip doesn't have any problem, but some frameworks are collided with pyaudio我认为pip没有任何问题,但有些框架与pyaudio发生冲突

here are error message shown.这是显示的错误消息。 What should I do?我该怎么办?

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/hq/cp10yz710x51x0qsxlrj5s5m0000gn/T/pip-install-b7gmavn1/pyaudio/setup.py'"'"'; __file__='"'"'/private/var/folders/hq/cp10yz710x51x0qsxlrj5s5m0000gn/T/pip-install-b7gmavn1/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/hq/cp10yz710x51x0qsxlrj5s5m0000gn/T/pip-record-zz9o5bbq/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/hq/cp10yz710x51x0qsxlrj5s5m0000gn/T/pip-install-b7gmavn1/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/hq/cp10yz710x51x0qsxlrj5s5m0000gn/T/pip-install-b7gmavn1/pyaudio/setup.py'"'"'; __file__='"'"'/private/var/folders/hq/cp10yz710x51x0qsxlrj5s5m0000gn/T/pip-install-b7gmavn1/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/hq/cp10yz710x51x0qsxlrj5s5m0000gn/T/pip-record-zz9o5bbq/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.

Try installing pipwin first using:首先尝试使用以下方法安装 pipwin:

 pip install pipwin

and then install Pyaudio using pipwin:然后使用 pipwin 安装 Pyaudio:

 pipwin install PyAudio

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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