python-3.x PyAudio安装错误:失败的构建轮

qyyhg6bp  于 2023-04-22  发布在  Python
关注(0)|答案(3)|浏览(163)

我想安装pyaudio,但我得到以下错误.我使用的是windows 10.我已经尝试了解决方案,在多个其他答案,但他们不为我工作.我下面的教程从YouTube.
验证码:

import pyttsx3
import datetime
import speech_recognition as sr
import wikipedia
import webbrowser
import os

r=sr.Recognizer()

engine = pyttsx3.init('sapi5')
voices=engine.getProperty('voices')
engine.setProperty('voice' , voices[1].id)


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

def takecommand():
    
    with sr.Microphone() as source:
        print("Listening.....")
        r.pause_threshold=1
        o=r.listen(source)
    try:
        print("Wait for few moments")
        query=r.recognize_google(o,language="en-in")
        print("user said ", query)
    except Exception as e :
        print(e)
        speak("Say that Again Please ")

if __name__ == "__main__":
    wishme()
    takecommand()

    while True :
        wishme()
        query = takecommand().lower()

        if"wikipedia" in query:
            speak("Searching in wikipedia")
            query=query.replace("wikipedia" ,"")
            results=wikipedia.summary(query,sentences=2)
            speak("According to wikipedia ")
            speak(results)
            print(results)

        elif"open youtube" in query:
            speak("opening Boss")
            webbrowser.open("youtube.com")
        elif "open google" in query:
            speak("opening Boss")
            webbrowser.open("google.com")

        elif "open code"in query:
            speak("opening Boss")
            codepath = "C:\\Users\\Murali\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe"
            os.startfile(codepath)

        elif "open chrome"in query:
            speak("opening Boss")
            chromepath = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
            os.startfile(chromepath)

edit1:我也试过pip install PyAudio,但没有用

7d7tgy0s

7d7tgy0s1#

请尝试pip安装它与此拼写:

pip install PyAudio

如果不起作用,请从该页面下载文件PyAudio,然后cd到该目录并使用此命令python setup.py install

wgx48brx

wgx48brx2#

尝试从这里安装PyAudio轮只需在本网站中使用Ctrl + F搜索PyAudio并下载一个,这是与您的PC兼容.此外,把它放在目录中,您有其余的模块/库在Windows上安装Python期间保存.希望它有帮助!:-)

zengzsys

zengzsys3#

对于那些有这个问题的人,如果你在Mac上,那么你需要首先通过自制软件安装portaudio。在他们的文档中,你需要按以下顺序运行命令:

brew install portaudio
pip install pyaudio

相关问题