python flask import error

Just rename flask.py file also delete flask.pyc file


I ran into this error because I named the test file as flask.py and tried to run it! It creates namespace conflict with the real flask module!

Delete the local test file that you named flask.py and the respective flask.pyc. Give some other name! This will happen with other modules like socket etc where you are likely to give the same name for the test file as the standard module :-)


The reason is your python file name is flask.


Just run apt-get install python3-flask

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