【问题记录】ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based..

问题:pip install pyaudio 时报错如下

Collecting pyaudio
  Using cached PyAudio-0.2.12.tar.gz (42 kB)
  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-37
      copying src/pyaudio.py -> build/lib.linux-x86_64-cpython-37
      running build_ext
      building '_portaudio' extension
      creating build/temp.linux-x86_64-cpython-37
      creating build/temp.linux-x86_64-cpython-37/src
      gcc -pthread -B /home/dreamdeck/anaconda3/envs/audio2face/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -I/usr/include -I/home/dreamdeck/anaconda3/envs/audio2face/include/python3.7m -c src/_portaudiomodule.c -o build/temp.linux-x86_64-cpython-37/src/_portaudiomodule.o
      src/_portaudiomodule.c:31:10: fatal error: portaudio.h: No such file or directory
       #include "portaudio.h"
                ^~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/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 apt-get install portaudio19-dev
pip install pyaudio

二、手动解决

但无法从源来安装包时,可以下载包来解决

wget http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz
tar -zxvf pa_stable_v190600_20161030.tgz 
cd portaudio/
./configure && make && sudo make install 
pip install pyaudio
引用: “This error originates from a subprocess, and is likely not a problem with pip.ERROR: Failed building wheel for cartopy Failed to build cartopy ERROR: Could not build wheels for cartopy, which is required to install pyproject.toml-based projects” 引用: lanms_neo-1.0.2-cp38-cp38-win_amd64.whl 免编译直装版 error: Microsoft Visual C 14.0 or greater ...ERROR: Could not build wheels for lanms-neo, which is required to install pyproject.toml-based projects。 引用: pip install C:\Users\97421\anaconda3\envs\env3\Cartopy-0.20.2-cp39-cp39-win_amd64.whl。 对于您的问题,"Could not build wheels for cchardet, which is required to install pyproject.toml-based projects",这个错误通常是由于缺少必要的编译工具或依赖项导致的。解决此问题的方法有几种: 1. 您可以尝试使用预编译的安装包,类似于引用中提到的"免编译直装版"。查找并下载与您的操作系统和Python版本匹配的预编译包,然后使用pip进行安装。 2. 可能需要安装一些必要的编译工具。例如,在Windows上,您可能需要安装Microsoft Visual C++ Build Tools。可以从Microsoft官方网站下载并安装适用于您的操作系统版本和Python版本的编译工具。 3. 如果您有特定版本的安装包文件(例如引用中提到的Cartopy安装包),您可以使用pip安装该文件进行安装。确保指定正确的文件路径并执行相应的命令。 请注意,解决此类错误可能需要根据您的具体环境和配置进行调整。如果您仍然遇到困难,建议查看相关文档或寻求相关技术支持以获取更详细的帮助。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

呆呆的猫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值