flask hello world程序中的错误无法导入flask

时间:2019-01-28 13:40:25

标签: python flask

$ python app.py
Traceback (most recent call last):
  File "app.py", line 1, in <module>
    from flask import FLASK
ImportError: cannot import name 'FLASK' from 'flask' (/Users/kiran/anaconda3/lib/python3.7/site-packages/flask/__init__.py)

2 个答案:

答案 0 :(得分:3)

您错误地将flask大写。应该是:

from flask import Flask

答案 1 :(得分:0)

此处** FLASK *表示错误,而不是FLASK写Flask

from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
  return "Hello World!"

if __name__ == "__main__":
   app.run()