我想安装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
,但没有用
3条答案
按热度按时间7d7tgy0s1#
请尝试pip安装它与此拼写:
如果不起作用,请从该页面下载文件PyAudio,然后cd到该目录并使用此命令
python setup.py install
wgx48brx2#
尝试从这里安装PyAudio轮只需在本网站中使用
Ctrl + F
搜索PyAudio并下载一个,这是与您的PC兼容.此外,把它放在目录中,您有其余的模块/库在Windows上安装Python期间保存.希望它有帮助!:-)zengzsys3#
对于那些有这个问题的人,如果你在Mac上,那么你需要首先通过自制软件安装portaudio。在他们的文档中,你需要按以下顺序运行命令: