Import "speech_recognition" could not be resolved
Question:
I installed the speech recognition and the pyttsx3 libraries
pip install SpeechRecognition
pip install pyttsx3
but when i try to import them it gives two errors
Import "speech_recognition" could not be resolved
Import "pyttsx3" could not be resolved
heres my code
import speech_recognition as sr
import pyttsx3
audio = sr.Recognizer()
Answers:
Usually this happens because of virtual env or interpreter issues. Possible fixes:
-
Make sure that the interpreter you are using inside your IDE, is the same as the one in which you installed the libraries.
-
Same as above in case of virtual env.
-
If your IDE is VS Code, then open the settings.json file and set python server to Jedi instead of Microsoft/Pylance.
I faced similar issues, was unable to diagnose the exact cause, but somehow the popular CodeRunner extension and VS code’s recommended python extensions were in conflict. Therefore, i disabled the former and the program executed without any issues
I installed the speech recognition and the pyttsx3 libraries
pip install SpeechRecognition
pip install pyttsx3
but when i try to import them it gives two errors
Import "speech_recognition" could not be resolved
Import "pyttsx3" could not be resolved
heres my code
import speech_recognition as sr
import pyttsx3
audio = sr.Recognizer()
Usually this happens because of virtual env or interpreter issues. Possible fixes:
-
Make sure that the interpreter you are using inside your IDE, is the same as the one in which you installed the libraries.
-
Same as above in case of virtual env.
-
If your IDE is VS Code, then open the settings.json file and set python server to Jedi instead of Microsoft/Pylance.
I faced similar issues, was unable to diagnose the exact cause, but somehow the popular CodeRunner extension and VS code’s recommended python extensions were in conflict. Therefore, i disabled the former and the program executed without any issues