Cannot find Python 3.8.2 path on Windows 10

Question:

I have Windows 10 on my computer and when I use the cmd and check python --version, I get python 3.8.2. But when I try to find the path for it, I am unable to find it through searching on my PC in hidden files as well as through start menu. I don’t seem to have a python 3.8 folder on my machine. Anybody have any ideas how to find it?

Asked By: Sasha Hurwitz

||

Answers:

If you can open the python interpreter sys.executable will give you the path.

import sys
print(sys.executable)
Answered By: moeen.n

Python paths in Windows can get a little strange. I prefer to use the official packages from python.org. And I use the "install for all users" option. Finally, I prefer to have my Python installs one level below C: drive, i.e. C:Python37.

If you do not use the "install for all users" option, the Python directory gets buried in C:Usersxxxxxx somewhere. And some IDEs (I’m looking at you PyCharm) like to install everything in virtual environments (venv).

@moeen.n answer of sys.executable is probably the easiest to find out where your install is.

Answered By: bfris

If you’re using cmd (ie Command Prompt), and typing python works, then you can get the path for it by doing where python. It will list all the pythons it finds, but the first one is what it’ll be using.

Answered By: Tim

I found an easy hack, after the default install if you again run the installer and select Modify, then proceed further and you will get an option to Add Python to environment variables.
enter image description here

Answered By: Koder101
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.