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 trialPiotr Manczak
Front End Web Development Techdegree Graduate 29,324 Pointsflask 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
Treehouse Moderator 28,720 PointsIt 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
Jeff Muday
Treehouse Moderator 28,720 PointsAlso, 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!
Piotr Manczak
Front End Web Development Techdegree Graduate 29,324 PointsThank you. I will have a look. It is working now. It seems that it is all about correct file location.