I want to install pyaudio but I am getting the following error. I am using windows 10. I have tried solution given in multiple other answers but they were not working for me. I am following a tutorial from YouTube.
code :
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 : I have tried pip install PyAudio
as well and it did not work
CodePudding user response:
Please try pip installing it with this spelling :
pip install PyAudio
If it doesn't work, download the files from this page PyAudio, then cd into that directory and use this command python setup.py install
CodePudding user response:
Try installing the PyAudio wheel from Here
Just search for PyAudio using Ctrl F
in this site and download the one, that is compatible with your PC. Further, put it in the directory where you have rest of your modules/libraries saved during the installation of Python on your Windows. Hope it helps! :-)