Python Speech Recognition: 'module' object has no attribute 'microphone'

Fix found -

pip install SpeechRecognition

pip install pyaudio

If you found error -

sudo apt-get install python-pyaudio

sudo apt-get install libjack-jackd2-dev portaudio19-dev

Then again -

pip install pyaudio

For 2.7: The PyPI SpeechRecognition page mentions Microphone rather than microphone. Try capitalizing the name. If you had tried

>>> import speech_recognition as sr
>>> dir(sr)

to see what attributes the module does have, you would likely have discovered the mistake.

For 3.4, I suspect you downloaded and installed the sr module only for 2.7. At a command line (using the Windows version, adjust for another OS as needed)

.../python34/Scripts> pip install SpeechRecognition

should install for 3.4.


To fix this issue, try to open the terminal and execute:

brew install portaudio
pip install pyaudio

I hope this works for U ;)