Python error In Flask framework import

Asked

Viewed 363 times

0

after installing python and declaring environment variables, creating a page and trying to run by Command Prompt sends the following error :

Traceback (most recent call last):
  File "app.py", line 1, in <module>
    from flask import Flask
ImportError: cannot import name 'Flask' from 'flask' (unknown location)
  • 1

    Already installed him?

  • yes installed uninstalled and installed again, but always presents the same error.

  • installed Django, and from something like that I think it’s some mistake I made with installing Pip/ virtualenv dependencies, but even reinstalling the problem

1 answer

2


You cannot call the flask.py file because it is trying to import the Flask name from itself. It’s simple, try naming the app.py file or something other than Flask and it will work.

  • 1

    As you concluded that the file is called flask.py?

  • By the from flask import Flask, but mainly because I had seen it before with a friend and when I went to look at the code for it was there flask,py.

  • What about File "app.py", line 1, in <module>?

  • installed Django is easier

Browser other questions tagged

You are not signed in. Login or sign up in order to post.