安装Pyaudio时出错

2024-09-28 22:03:35 发布

您现在位置:Python中文网/ 问答频道 /正文

安装Pyaudio时出错:

desktop pip3 install pyaudio

Collecting pyaudio
  Using cached PyAudio-0.2.11.tar.gz (37 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/zv/lm59c9453z51471xvt84y4dh0000gn/T/pip-install-up3wfh5b/pyaudio_942d25ef389a45348210ea26cbdb6507/setup.py'"'"'; __file__='"'"'/private/var/folders/zv/lm59c9453z51471xvt84y4dh0000gn/T/pip-install-up3wfh5b/pyaudio_942d25ef389a45348210ea26cbdb6507/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/zv/lm59c9453z51471xvt84y4dh0000gn/T/pip-wheel-jw8svb28
       cwd: /private/var/folders/zv/lm59c9453z51471xvt84y4dh0000gn/T/pip-install-up3wfh5b/pyaudio_942d25ef389a45348210ea26cbdb6507/
  Complete output (16 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-universal2-3.10
  copying src/pyaudio.py -> build/lib.macosx-10.9-universal2-3.10
  running build_ext
  building '_portaudio' extension
  creating build/temp.macosx-10.9-universal2-3.10
  creating build/temp.macosx-10.9-universal2-3.10/src
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -DMACOSX=1 -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-universal2-3.10/src/_portaudiomodule.o
  src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
  #include "portaudio.h"
           ^~~~~~~~~~~~~
  1 error generated.
  error: command '/usr/bin/clang' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for pyaudio
  Running setup.py clean for pyaudio
Failed to build pyaudio
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.10/bin/python3.10 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/zv/lm59c9453z51471xvt84y4dh0000gn/T/pip-install-up3wfh5b/pyaudio_942d25ef389a45348210ea26cbdb6507/setup.py'"'"'; __file__='"'"'/private/var/folders/zv/lm59c9453z51471xvt84y4dh0000gn/T/pip-install-up3wfh5b/pyaudio_942d25ef389a45348210ea26cbdb6507/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/zv/lm59c9453z51471xvt84y4dh0000gn/T/pip-record-bz5k4buf/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/pyaudio
         cwd: /private/var/folders/zv/lm59c9453z51471xvt84y4dh0000gn/T/pip-install-up3wfh5b/pyaudio_942d25ef389a45348210ea26cbdb6507/
    Complete output (16 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-universal2-3.10
    copying src/pyaudio.py -> build/lib.macosx-10.9-universal2-3.10
    running build_ext
    building '_portaudio' extension
    creating build/temp.macosx-10.9-universal2-3.10
    creating build/temp.macosx-10.9-universal2-3.10/src
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -DMACOSX=1 -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-universal2-3.10/src/_portaudiomodule.o
    src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
    #include "portaudio.h"
             ^~~~~~~~~~~~~
    1 error generated.
    error: command '/usr/bin/clang' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/zv/lm59c9453z51471xvt84y4dh0000gn/T/pip-install-up3wfh5b/pyaudio_942d25ef389a45348210ea26cbdb6507/setup.py'"'"'; __file__='"'"'/private/var/folders/zv/lm59c9453z51471xvt84y4dh0000gn/T/pip-install-up3wfh5b/pyaudio_942d25ef389a45348210ea26cbdb6507/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/zv/lm59c9453z51471xvt84y4dh0000gn/T/pip-record-bz5k4buf/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.10/include/python3.10/pyaudio Check the logs for full command output.

enter image description here

enter image description here


Tags: installpippybuildvarsetupcodeprivate