0
#raise AttributeError("Could not find PyAudio; check installation")

# AttributeError: Could not find PyAudio; check installation

# I have tried every type of pip or sudo type of commands but its # not working it just says PyAudio is missing

import speech_recognition as sr

# get audio from the microphone
r = sr.Recognizer()
with sr.Microphone() as source:
    print("Speak:")
    audio = r.listen(source)

try:
    print("You said " + r.recognize_google(audio))
except sr.UnknownValueError:
    print("Could not understand audio")
except sr.RequestError as e:
    print("Could not request results; {0}".format(e))
desertnaut
  • 57,590
  • 26
  • 140
  • 166
  • e__, 'exec'))" install --record /private/var/folders/bd/tl0f7qxn4hg1btz77np_5qsr0000gn/T/pip-record-_r14muyy/install-record.txt --single-version-externally-managed --compile --install-headers /Users/lokeshv/PycharmProjects/Test/venv/include/site/python3.7/pyaudio" failed – lokesh v sanjit Jul 14 '19 at 23:02
  • Perhaps try the steps from here: https://stackoverflow.com/questions/33851379/pyaudio-installation-on-mac-python-3 – zmike Jul 14 '19 at 23:16

2 Answers2

3

You may need to get some additional packages, based off of operating system.

Debian Linux

If you don't have Homebrew (brew), download the it here.

$ brew install portaudio
$ pip install pyaudio

MacOS

If you don't have Homebrew (brew), download the it here.

$ brew install portaudio
$ pip install pyaudio

Windows

$ pip install pyaudio

I found this answer here.

Community
  • 1
  • 1
Nv7
  • 406
  • 6
  • 20
0

You can directly install the PyAudio Wheel from here

For more info on using speech recognition with python you can check out this