> 文章列表 > 【Python38安装PyAudio过程出现错误如:Failed building wheel for PyAudio等一系列问题】

【Python38安装PyAudio过程出现错误如:Failed building wheel for PyAudio等一系列问题】

【Python38安装PyAudio过程出现错误如:Failed building wheel for PyAudio等一系列问题】

安装PyAudio过程出现错误:Failed building wheel for PyAudio

  • 目前成功解决
    • 解决过程
      • (1) 解决方法1 查看pip支持安装whl文件的命名方式:没解决
      • (2)解决方法2 直接用终端解决

目前成功解决

环境:Windows11、python3.8.16、wheel0.34.1

解决过程

  1. 使用wheel安装显示不支持(我也把pip3换成pip试过,同样不行)
pip3 install ./PyAudio-0.2.11-cp38-cp38-win_amd64.whlERROR: PyAudio-0.2.11-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.

(1) 解决方法1 查看pip支持安装whl文件的命名方式:没解决

import pip._internal.pep425tags
print(pip._internal.pep425tags.get_supported())
print(pip.pep425tags.get_supported())结果:失败
ModuleNotFoundError: No module named 'pip._internal.pep425tags'

试试别的

import pip._internal
print(pip._internal.pep425tags.get_supported())结果:失败
AttributeError: module 'pip._internal' has no attribute 'pep425tags'

再试试

import wheel.pep425tags as w
print(w.get_supported("amd64"))结果:失败
ModuleNotFoundError: No module named 'wheel.pep425tags'

在这里我查看了一下我的wheel版本,是wheel 0.37,有网友说wheel 0.34支持的东西0.35就不支持了,又把wheel版本换成了 0.34.1,重新试了一下,还是报错

在终端(我是anaconda prompt)输入这个可以得到pip支持的wheel格式

python -m pip debug --verbose

【Python38安装PyAudio过程出现错误如:Failed building wheel for PyAudio等一系列问题】
这里箭头所指的都是支持,我把下载的whl文件名改成下面两种试了一下都还是不行

pip install PyAudio-0.2.11-cp38-none-any.whl
pip install PyAudio-0.2.11-cp38-cp38-win_amd64.whl显示:
ERROR: PyAudio-0.2.11-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.

(2)解决方法2 直接用终端解决

  • 因为我使用的是anaconda的虚拟环境,所以要将下载下来的pyaudio.whl文件放到虚拟环境的Script中去
  • 先找到python环境目录,再找这个envs,这里存放的是虚拟环境【Python38安装PyAudio过程出现错误如:Failed building wheel for PyAudio等一系列问题】
  • 我只有一个虚拟环境
    【Python38安装PyAudio过程出现错误如:Failed building wheel for PyAudio等一系列问题】
    点进去之后找到Script,将pyaudio.whl文件放进去
    【Python38安装PyAudio过程出现错误如:Failed building wheel for PyAudio等一系列问题】
  • 打开虚拟环境终端(我这里是anaconda prompt)
    输入
pip install E:\\你自己的文件路径\\Scripts\\PyAudio-0.2.11-cp38-none-any.whl显示:
Processing e:\\python_edu\\envs\\python38\\scripts\\pyaudio-0.2.11-cp38-none-any.whl
Installing collected packages: PyAudio
Successfully installed PyAudio-0.2.11

再输入

pip install pyaudio显示:
Requirement already satisfied: pyaudio in e:\\python_edu\\envs\\python38\\lib\\site-packages (0.2.11)

就安装成功了
查看一下能不能import
ok,没有报错

import pyaudio