calvincani
calvincani

Reputation: 353

Module installed but Python cannot find it

I am using VS Code running Python 3.9 I have set up a virtual environment using pipenv shell and I installed flask-script as displayed here in my pipfile:

   [packages]
   flask = "*"
   sqlalchemy = "*"
   flask-sqlalchemy = "*"
   flask-script = "*"
   flask-migrate = "*"

Still the import at the top of the Python file shows yellow underline and: Import "flask_script" could not be resolved Pylance report MissingImports

and if you try and run it it says: ModuleNotFoundError: No module named 'flask_script'

So how does it work please? This happens with other modules now and again too. How are you supposed to install a module?

Any help is appreciated

Upvotes: 1

Views: 1119

Answers (1)

Guillermo Brachetta
Guillermo Brachetta

Reputation: 4775

Maybe you need to select the correct python interpreter for the dependencies to be found.

enter image description here

Make sure it's the one for your virtual environment (You should see the parentheses as here in the screenshot, you can click there and select the correct one).

Upvotes: 2

Related Questions