Search code examples
pythonwindowscmd

How can I find out the path of the Python that the py Launcher uses?


I have multiple Python installations and when working on different projects, these can cause some confusion. I just recently found out, that under Windows there also is a py Launcher installed and updated alongside each installation of Python. That is useful tool, but I think this py launcher is messing up some things for me.

I'd like to find out, which python installation it defaults to. How can I do this on cmd?

Usually, to avoid using the wrong installation, I check in the command line (cmd) with the following commands:

where python
where python3      # when specifying 
where pip          # when installing packages

But for the py Launcher I can't use this:

where py        # gives: C:\Windows\py.exe
py --version    # gives Python 3.9.5, but not the path of the installation (i have multiple python 3.9.5)

Is there something like py --path?


Solution

  • I just found the corresponding command

    py -0p
    

    Lists all installed Pythons (-0) found by py Launcher for Windows with paths (p).