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

Piotr Manczak
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Piotr Manczak
Front End Web Development Techdegree Graduate 28,941 Points

flask invisible for my machine

I have imported flask via CMD and I know for a fact that flask is installed on my computer. However when I type import flask into my python file/idle I get this message:

Traceback (most recent call last): File "C:/Users/Piotr Manczak/myproject/simple_app.py", line 1, in <module> from flask import Flask ModuleNotFoundError: No module named 'flask'

How can make flask work?

3 Answers

Jeff Muday
MOD
Jeff Muday
Treehouse Moderator 28,717 Points

It might be your PYTHONPATH is not initialized properly. You can read more about it here:

https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATH

Here is a good install guide for installing Python--

https://www.youtube.com/watch?v=YKSpANU8jPE

Here is a video of a developer that installing both Flask and Python

https://www.youtube.com/watch?v=vCi2aDNXml8

Jeff Muday
MOD
Jeff Muday
Treehouse Moderator 28,717 Points

Also, when you have time, you should look into virtual environments. Virtual environments allow having multiple Python environments. This is extremely helpful if you are developing different Python versions that may also have different versions of packages.

This has saved me a lot of time and agony!