Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Import "speech_recognition" could not be resolved

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

import speech_recognition as sr
import pyttsx3

audio = sr.Recognizer()

>Solution :

Usually this happens because of virtual env or interpreter issues. Possible fixes:

  1. Make sure that the interpreter you are using inside your IDE, is the same as the one in which you installed the libraries.

  2. Same as above in case of virtual env.

  3. 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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading