So I get an error like the following:
Traceback (most recent call last):
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\speech_recognition\__init__.py", line 108, in get_pyaudio
import pyaudio
ModuleNotFoundError: No module named 'pyaudio'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\pc\Desktop\lerconn.py", line 3, in <module>
with spr.Microphone() as mic:
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\speech_recognition\__init__.py", line 79, in __init__
self.pyaudio_module = self.get_pyaudio()
File "C:\Users\pc\AppData\Local\Programs\Python\Python38-32\lib\site-packages\speech_recognition\__init__.py", line 110, in get_pyaudio
raise AttributeError("Could not find PyAudio; check installation")
AttributeError: Could not find PyAudio; check installation
with a basic speech/sound recognition system:
import speech_recognition as spr
with spr.Microphone() as mic:
try:
audin = rec.recognize_google(rec.listen(mic), language="tr-TR")
print(audin)
except spr.UnknownValueError:
# response= rand(notexisterrors)
response = "I don't currently know the word or the phrase."
except spr.RequestError:
# response = rand(reqerrors)
response = "Some weird problems with your system."
else:
# response = rand(unknownerrors)
response = "Unknown error, I don't get it."
print(response)
I tried pip install
'ing PyAudio looking at the error, but that didn't work either.
I use: Python 3.8.5 - Text Editor(s): Notepad, Notepad++ and IDLE - OS: Windows 10 Pro 64 Bit
Feel free to ask anything. Thanks in advance!
I got the
ModuleNotFoundError: No module named 'pyaudio'
message when trying to run your example with theSpeechRecognition
package installed only. It seems to be working if you complement withpipwin
andpyaudio
.Install by running:
Then I had a small issue with finding correct mic index but this works for me: