ModuleNotFoundError: No module named 'speech_recognition'

7.3k Views Asked by At

I am using powershell and scoop, windows. I already installed speech_recognition bucket but still showing the error.

Code:
import speech_recognition as sr
import time
import json
import requests
import thread
import subprocess

SPLUNK_URL = "https://localhost"
# Splunk http event collector token
hec_token = "" 
1

There are 1 best solutions below

0
Dhruv Joshi On

The python interpreter shows a ModuleNotFoundError when it can't find the module being imported. For more information on how import works, click here.

Since you have installed latest python 3.7, and are working on a code snippet that was built 2 years ago, there is likely a case that the speech_recognition module might not be installed for your current python.

Before you try anything, execute

pip list

and see all the modules currently installed for your current python interpreter. If the speech_recognition module is not available in the list, then install it:

pip install SpeechRecognition

Also, if you are having multiple python versions installed on your system then make sure you use the pip installer of the python interpreter that you are using for your application. If you are using or like having multiple python versions, then I suggest you use a tool like pyenv.