22

I'm trying to use different versions of python on win7, and I was told that I can use the python laucher.

I find the docs for it: https://docs.python.org/3/using/windows.html#launcher But I don't know where is it. Someone say its called py.exe, but there is no file with this name on my computer.

I installed python 3.4.3 with Anaconda, https://store.continuum.io/cshop/anaconda/, comes with Scipy

===========

UPDATE: Since there is no python launcer in Anacoda, how can I re-install it? Or if there is better way of using different version on Win7?

ZK Zhao
  • 19,885
  • 47
  • 132
  • 206

5 Answers5

22

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.

EDIT: Anaconda does not come with Python launcher. It is only available for an ActiveState, standard, or probably many other installs.

EDIT2: Here are two brand-new, Python 3.4 installs of ActiveState Python and Anaconda Python, screenshotted. Notice how Anaconda Python does not include py.exe and a lot of other (non-essential) executables?

Anaconda Install ActiveState Install

EDIT3: After some "difficult" testing, just set anaconda as your default install for Python3.4 and grab the py.exe from another install. That is all. So you can install Python3.4 from another source, uninstall it, and save the py.exe, make sure it is in the system path, and the python launcher is fully installed.

EDIT4: Actually there's also a standalone installer available here: https://bitbucket.org/vinay.sajip/pylauncher/downloads

Alex Huszagh
  • 13,272
  • 3
  • 39
  • 67
  • Hmm, your answer seems perhaps more useful than mine - not sure why it was downvoted. – Jakob Weisblat Jun 12 '15 at 02:33
  • Not sure but yours is useful. I just added screenshots to try to clarify this. – Alex Huszagh Jun 12 '15 at 02:36
  • 1
    Then how can I install it? And is there anyother good distribution? I really like `Anaconda` comes with `Scipy`, makes python much more accssible for laymen like me. – ZK Zhao Jun 12 '15 at 02:43
  • 2
    There's a standalone installer available here: https://bitbucket.org/vinay.sajip/pylauncher/downloads – Alex Huszagh Jun 12 '15 at 02:51
  • 3
    This answer is ... blatantly not correct. The Python installer(s) put `py.exe` in `%SYSTEMROOT%`. – Will Apr 20 '18 at 21:40
  • 8
    @Will, This answer is nearly 3 years old and tools change in much shorter periods. If information has changed in that time, you are free to update it with newer versions of software, or write a comment so I may do so. Your aggressive post stating that the information is blatantly incorrect completely ignores the time at which it was posted. – Alex Huszagh Apr 20 '18 at 21:48
13

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).

I think if you don't install for all users, then it's in the python install root.

If you are able to run py from cmd.exe, then you can find out where it is with where py.exe.

0xC0000022L
  • 20,597
  • 9
  • 86
  • 152
idbrii
  • 10,975
  • 5
  • 66
  • 107
3

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.

Jakob Weisblat
  • 7,450
  • 9
  • 37
  • 65
  • 1
    No. The Python launcher is py.exe which is found main directory in the standard install, as well as the ActiveState Python installs for Python 3.3 and later. – Alex Huszagh Jun 12 '15 at 02:29
  • 1
    It doesn't come default, by the way. – Alex Huszagh Jun 12 '15 at 02:30
  • "*It looks like the python executable is part of the conda command*", that would make sense as conda is used to select which "virtual" environment is activated (actually these virtual environments seem to be plain and redundant installations). How can the two cohabit? I wonder if life wouldn't be easier if conda was limited to configuration management, and the python launcher always used to select the right environment based on shebang lines. – mins Jul 14 '23 at 13:16
2

If NOT installed for ALL users, (python 3.11.3) it goes to:

C:\Users\XXXX\AppData\Local\Programs\Python\Launcher\py.exe

1

I first tried everything Alexander Huszagh has written. But none of it helped.

It took me a really long time to find the Python Launcher. I had accidentally changed how to open .py-files. And once you change it, you can't do right mouse click "Edit with IDLE" anymore. I eventually found them in the C:\Windows\ directory named py.exe.

johnny
  • 21
  • 1
  • 4