I installed speech recognition

pip install SpeechRecognition

ran this

import speech_recognition as sr
r = sr.Recognizer()

with sr.Microphone() as source:
    audio = r.listen(source)


and got this error

Traceback (most recent call last):
    import speech_recognition as sr
ImportError: No module named 'speech_recognition'

Your tag says python3. If you are running your code in python3 you need to install speechrecognition with pip3.


As T. M.'s answers points out you need to make sure that the modules are installed for the Python version you are using.

If you're running several version of Python and pip you might want to check that you are using the corresponding pip version. It might look like this:

# python --version
Python 3.7.1
# pip --version
pip 18.0 from /usr/lib/python3.7/site-packages/pip (python 3.7)

If pip --version returns something not reading "(python 3.x)" you should use pip3 to install modules for Python3. However, since End of Life for Python 2.7 is coming any sane distribution would want pip to be pip3.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.