使用 Python 创建像 Jarvis 这样的语音助手,但 PyAudio 无法工作:“错误:无法构建 PyAudio”

问题描述 投票:0回答:1

当我尝试在 Python 版本 3.13.0 中安装 PyAudio 包时。出现以下错误:
我该如何修复它以及为什么会出现此错误?

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

[notice] A new release of pip is available: 24.2 -\> 24.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (PyAudio)

我尝试了一些方法通过安装一些软件包来修复此错误。

源代码:

import pyttsx3
import speech_recognition as sr

engine = pyttsx3.init()
voices = engine.getProperty('voices')       #getting details of current voice
# for voice in voices:
engine.setProperty('voice', voices)    # setting up volume level  between 0 and 1
engine.setProperty('rate', 130)


def speak(command):
  engine.say(command)
  engine.runAndWait()

# obtain audio from the microphone
r = sr.Recognizer()
with sr.Microphone() as source:
    print("Say something!")
    audio = r.listen(source)

# recognize speech using Google Speech Recognition
try:
    print("Google Speech Recognition thinks you said " + r.recognize_google(audio))
except sr.UnknownValueError:
    print("Google Speech Recognition could not understand audio")
except sr.RequestError as e:
    print("Could not request results from Google Speech Recognition service; {0}".format(e))


# speak("Hello bro can I help you with your query?")
python pyaudio
1个回答
0
投票

PyAudio 在 Python 3.13 中预编译时出现错误,是的,PyAudio 版本较新,PyAudio 没有实际运行。

Intenta instalar el paquete 车轮底漆: pip 安装轮子

© www.soinside.com 2019 - 2024. All rights reserved.