I had same issue which was solved by executing below commands. pip install pipwin pipwin install pyaudio
Here is what the above code is Doing:
1. We import the SpeechRecognition library.
2. We create a new SpeechRecognition object called r.
3. We use the Microphone class to get input from the user’s microphone.
4. We use the listen() method to listen for the user’s input.
5. We use the recognize_google() method to return the user’s spoken text.
6. We print the user’s spoken text to the screen.