pyaudio报错

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

安装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
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值