Uberi / speech_recognition

Speech recognition module for Python, supporting several engines and APIs, online and offline.
https://pypi.python.org/pypi/SpeechRecognition/
BSD 3-Clause "New" or "Revised" License
8.44k stars 2.4k forks source link

Speech Recognition not working #498

Open Dave234322 opened 4 years ago

Dave234322 commented 4 years ago

I am trying to use speech recognition on python 3.8 i am fairly new to programming and i have tried multiple solution such as using pip to install pyaudio but it says "Command 'pip' not found but there are 18 similar ones" the code i am using is:

import speech_recognition as sr

r = sr.Recognizer() with sr.Microphone() as source: print("Say something!") audio = r.listen(source)

try: print("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))

the error i get is: During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/isaac/.config/JetBrains/PyCharmCE2020.2/scratches/scratch.py", line 5, in with sr.Microphone() as source: File "/usr/local/lib/python3.8/dist-packages/speech_recognition/init.py", line 79, in init self.pyaudio_module = self.get_pyaudio() File "/usr/local/lib/python3.8/dist-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

Process finished with exit code 1

I am using Ubuntu 20.04 and using the software pycharm

maschmi1 commented 4 years ago

@Dave234322 there’s probably configuration in pycharm that you need to do to point to the correct Python installation. Try to run it from the terminal and see if you get the same thing. If you do you probably need to install pip.

For Ubuntu it should just be

sudo apt install python3-pip
saiphani1998 commented 4 years ago

install pip and later that install pyaudio. sudo apt install python3-pip pip3 install pyaudio

TSSwork commented 4 years ago

Reinstall Python in your compuer .This time tick the check box Add Python 3.x to PATH(When installs you may have not given it download .Sometimes python command doesn't work because of it.) Then install by using pip pip install pyaudio-to install pip uninstall pyaudio-to uninstall

if yhe above install didn't work try - pip install pipwin then pipwin install pyaudio