I am following the tutorial here.
My file looks like this:
from flask import Flask
app = Flask(__name__)
@app.route("/")
def main():
return "Welcome!"
if __name__ == "__main__":
app.run()
I run python app.py
and get the following:
Traceback (most recent call last):
File "app.py", line 1, in <module>
from flask import Flask
ImportError: No module named Flask
I do have flask installed. I was thinking it's a $PATH issue. I don't really know where to begin as far as troubleshooting goes.
which flask
gives me:
/usr/local/bin/flask
which python
gives me:
/usr/bin/python
Any help is much appreciated, there are other similar issues out there but those solutions have not helped. Happy to answer any questions. Thank you.
Answers to questions:
Q. Which Python version? A. Python 2.7.10
Q. How did you install Flask? A. pip install flask
flask
next toapp.py
. – dirnflask
or a file you namedflask.py
in the same directory? – CAB