ERROR: Failed building wheel for PyAudio

问题描述:

centos7 终端安装PyAudio,指令:pip install PyAudio
出现错误:

Collecting PyAudio
  Downloading PyAudio-0.2.12.tar.gz (42 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 42.9/42.9 kB 427.1 kB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: PyAudio
  Building wheel for PyAudio (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for PyAudio (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-38
      copying src/pyaudio.py -> build/lib.linux-x86_64-cpython-38
      running build_ext
      building '_portaudio' extension
      creating build/temp.linux-x86_64-cpython-38
      creating build/temp.linux-x86_64-cpython-38/src
      gcc -pthread -B /root/miniconda3/envs/myfirst/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -I/usr/include -I/root/miniconda3/envs/myfirst/include/python3.8 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-cpython-38/src/_portaudiomodule.o
      src/_portaudiomodule.c:31:23: 致命错误:portaudio.h:没有那个文件或目录
       #include "portaudio.h"
                             ^
      编译中断。
      error: command '/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for PyAudio
Failed to build PyAudio
ERROR: Could not build wheels for PyAudio, which is required to install pyproject.toml-based projects

解决:


sudo yum -y install portaudio portaudio-devel

pip install PyAudio

参考:

参考链接1
参考链接2

你可能感兴趣的:(其他)