python flask import error


I am running the following code

from flask import Flask
app = Flask(__name__)
def hello():
    return "Hello World!"
if __name__ == "__main__":'', port=80, debug=True)

and getting the following error

Traceback (most recent call last):
  File "", line 1, in <module>
    from flask import Flask
  File "/home/pi/programs/", line 1, in <module>
    from flask import Flask
ImportError: cannot import name Flask

I have tried installing flask through various methods , but still the problem persists

also, is there any alternative to flask???


Just run apt-get install python3-flask

Edited to install the python3 version, since nobody should be using python2 now.

Answered By – LtWorf

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published