Home > database >  Running flask in Python
Running flask in Python

Time:10-09

I am new to python and started with learning with spyder IDE. I was trying to run flask application in spyder but looks like I am making some mistakes while running it. Can anyone help me ?

enter image description here

If you see the above image... When I run app.py, i get error message as "No module names flask". But when I see flask version , i get 2.2.2 (meaning flask is already there). Then why I am getting this error?

I already installed flask in terminal

enter image description here

CodePudding user response:

I guess you have several versions of Python

First try this :

Comment lines 9 and 10

Create a new terminal in the path of the file and type this:

flask run

If this does not work, you can create a virtual environment in Python and install Flask in it

CodePudding user response:

The !flask command goes over your shell and calls flask.exe inside \Anaconda\Scripts this should work for every environment(?)

import flask goes over your current environment in which flask is not installed according to the error.

Did you create a new environment and run spyder from there?
If you open anaconda console -> python -> import flask
What happens then?

Rare chance that this is an error with your PATH but probably just the missing installation for the environment.

  • Related