Switching between Python 3.5 and 3.6 in Windows 7

6,434

Call py.exe instead of python:

  • py -3.6 will open a 3.6 shell;
  • py -3.5 will open a 3.5 shell;
  • py (check the version of an open shell: it could depend on installation and further settings).

Source: Python Launcher for Windows

New in version 3.3.

The Python launcher for Windows is a utility which aids in locating and executing of different Python versions. It allows scripts (or the command-line) to indicate a preference for a specific Python version, and will locate and execute that version.

Unlike the PATH variable, the launcher will correctly select the most appropriate version of Python. It will prefer per-user installations over system-wide ones, and orders by language version rather than using the most recently installed version.

Share:
6,434

Related videos on Youtube

Johnny Apple
Author by

Johnny Apple

Updated on September 18, 2022

Comments

  • Johnny Apple
    Johnny Apple over 1 year

    I seek to be able to type something like

    python36
    

    or:

    python35
    

    in the command prompt to be be able to run 3.6 or 3.5 shells, respectively. When I type python in the command prompt, it only opens a 3.5 shell, and if I try to specify 3.6 by typing python3.6 or python3.5 or python36 or python35, it doesn't recognize the commands. For both installations, I checked the "Add to my path" box, and have since tried to manually add them to my path using system settings/advanced/environment variables, etc, but it's not clear to me how to best do this.

    I am using Windows 7.

    • Ramhound
      Ramhound over 6 years
      How you modify the system and user variables on Windows is well documented what step are you stuck on, edit your question, be specific