Reputation: 21523
I'm trying to use different versions of Python on Windows 7, and I was told that I can use the "Python launcher"
But where is this program? I heard it should be called py.exe
, but there is no file with this name on my computer. Where should it be? If I don't have it, how can I install it?
Upvotes: 23
Views: 55811
Reputation: 41
When Python is not installed "for all users", the launcher goes to an %APPDATA%
subdirectory:
C:\Users\{your username}\AppData\Local\Programs\Python\Launcher\py.exe
Tested with Python 3.11.3.
Upvotes: 4
Reputation: 11916
If installing python from python.org's downloads and you select "[x] install pylauncher [x] install for all users", py.exe
is installed in C:\Windows\py.exe
(%SystemRoot%\py.exe
).
If you are able to run py
from cmd.exe
, then you can find out where it is with where py.exe
.
Upvotes: 16
Reputation: 14614
It should be in the root directory of Python 3.3 installs and higher. It is not available for Python2.
Go to C:\PythonXX\ and you should find py.exe for your version.
In Command Prompt or your favorite shell (like Cygwin), run:
py -3.3 -m path/to/myscript.py
However, this only works if you have a 3.3 or higher installed.
Note that Anaconda does not come with Python launcher. However, it will work to set Anaconda as your default install for Python 3.4 and install py.exe
separately. For example, you can install Python 3.4 from another source, copy its py.exe
to somewhere on the system path, and uninstall Python 3.4 again; then the python launcher is fully installed.
Better yet, there's a standalone installer available here.
Upvotes: 20
Reputation: 7910
It looks like the python executable is part of the conda
command if you're using Anaconda, according to their website. According to Alexander Huszagh (see his answer), the python launcher doesn't come with Anaconda python.
Here is a blog post that is perhaps relevant.
Upvotes: 3