Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Flask Basics Welcome to Flask First Steps

brandon nelson
brandon nelson
1,571 Points

Having trouble installing flask

Hi, I recently downloaded Python 3.5.1 and I am trying to install flask and run its libraries in my interpreter. I installed pip and flask in the terminal; however when I try to run something with flask in my interpreter I am getting an error.

The file I am trying to run is: from flask import Flask app = Flask(name)

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

if name == "main": app.run()

The error I am getting is: Traceback (most recent call last): File "/Users/elizabethcurrier/Documents/hello.py", line 1, in <module> from flask import Flask ImportError: No module named 'flask'

Thank you for any help with this. Brandon

1 Answer

Guy Scorpion
Guy Scorpion
11,053 Points

Looks like you missed the double underscores

app = Flask(__name__)

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