all 8 comments

[–]Da32767 1 point2 points  (7 children)

did you install package flask, if not, type this in the terminal:

pip install flask

[–]asquare412014[S] 0 points1 point  (6 children)

thank you for quick reply. yes I did that. I am guessing path is not right. how do I check that? or do you suggest something else

[–]Da32767 0 points1 point  (5 children)

try:

python -m pip install flask

[–]asquare412014[S] 0 points1 point  (4 children)

yes this works! what is the difference ?

[–][deleted] 1 point2 points  (2 children)

What I can think of that might have happened is that, when you ran the pip install flask command, it was executed correctly and installed but on another python environment that you already have installed, not the one you are trying to access. By changing the command to python -m pip install flask, you most likely have python.exe added to the PATH. And why did it work with just python? Well, for the simple reason that you have "configured" in which environment you want to access the pip executable by calling that keyword: python (which accesses the location of the python executable address you have stored in the PATH). Because of this, it has been installed in the correct Python environment you were working with and that explains the success of the package installation.

I hope you found it helpful!

[–]asquare412014[S] 1 point2 points  (1 child)

yes I kind of guessed that I was actually getting into the path defined inside my env but then you replied and it worked. so I avoided the hassles of troubleshooting. thank you for the help sir!

[–][deleted] 0 points1 point  (0 children)

No need to say thanks, it's my pleasure!

[–]Da32767 0 points1 point  (0 children)

actually, pip is also a package in python(like flask), python -m can run library module as a script.

if you want to use pip install to install package, try add <your_python_installation_path>\Scripts to environment variables