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?
Answers:
If you can open the python interpreter sys.executable
will give you the path.
import sys
print(sys.executable)
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.
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.
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?
If you can open the python interpreter sys.executable
will give you the path.
import sys
print(sys.executable)
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.
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.