当前位置: 首页 > 工具软件 > PyAudio > 使用案例 >

pyaudio报错

阎单鹗
2023-12-01

安装pyaudio报错 Error: failed building wheel for pyaudio

Collecting pyaudio
  Downloading PyAudio-0.2.11.tar.gz (37 kB)
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/456/miniconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ct4vzxya/pyaudio_1533125baf6a49f597c73d13cc069ad0/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ct4vzxya/pyaudio_1533125baf6a49f597c73d13cc069ad0/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 /tmp/pip-wheel-0tkhm98h
       cwd: /tmp/pip-install-ct4vzxya/pyaudio_1533125baf6a49f597c73d13cc069ad0/
  Complete output (14 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  copying src/pyaudio.py -> build/lib.linux-x86_64-3.9
  running build_ext
  building '_portaudio' extension
  creating build/temp.linux-x86_64-3.9
  creating build/temp.linux-x86_64-3.9/src
  gcc -pthread -B /home/456/miniconda3/compiler_compat -Wl,--sysroot=/ -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/456/miniconda3/include -fPIC -O2 -isystem /home/456/miniconda3/include -fPIC -I/home/456/miniconda3/include/python3.9 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.9/src/_portaudiomodule.o
  src/_portaudiomodule.c:29:23: fatal error: portaudio.h: 没有那个文件或目录
  compilation terminated.
  error: command '/usr/bin/gcc' 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: /home/456/miniconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ct4vzxya/pyaudio_1533125baf6a49f597c73d13cc069ad0/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ct4vzxya/pyaudio_1533125baf6a49f597c73d13cc069ad0/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 /tmp/pip-record-rlredyv7/install-record.txt --single-version-externally-managed --compile --install-headers /home/456/miniconda3/include/python3.9/pyaudio
         cwd: /tmp/pip-install-ct4vzxya/pyaudio_1533125baf6a49f597c73d13cc069ad0/
    Complete output (14 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.9
    copying src/pyaudio.py -> build/lib.linux-x86_64-3.9
    running build_ext
    building '_portaudio' extension
    creating build/temp.linux-x86_64-3.9
    creating build/temp.linux-x86_64-3.9/src
    gcc -pthread -B /home/456/miniconda3/compiler_compat -Wl,--sysroot=/ -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/456/miniconda3/include -fPIC -O2 -isystem /home/456/miniconda3/include -fPIC -I/home/456/miniconda3/include/python3.9 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.9/src/_portaudiomodule.o
    src/_portaudiomodule.c:29:23: fatal error: portaudio.h: 没有那个文件或目录
    compilation terminated.
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/456/miniconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ct4vzxya/pyaudio_1533125baf6a49f597c73d13cc069ad0/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ct4vzxya/pyaudio_1533125baf6a49f597c73d13cc069ad0/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 /tmp/pip-record-rlredyv7/install-record.txt --single-version-externally-managed --compile --install-headers /home/456/miniconda3/include/python3.9/pyaudio Check the logs for full command output.

解决方法

安装缺少的依赖

// An highlighted block
sudo apt install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg libav-tools

重新安装

Using cached PyAudio-0.2.11.tar.gz (37 kB)
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (setup.py) ... done
  Created wheel for pyaudio: filename=PyAudio-0.2.11-cp39-cp39-linux_x86_64.whl size=26089 sha256=b36a4394232cee38a95de923c5e5ee632c0c5b3d8fc0d51335843ad12b6dd5f3
  Stored in directory: /home/456/.cache/pip/wheels/76/e7/d6/193c174cc4cba9409e8eecea8f9e986fc9c88e08160759dfe8
Successfully built pyaudio
Installing collected packages: pyaudio
Successfully installed pyaudio-0.2.11
 类似资料: