I recently tried to uninstall Python 3.5.2 and installed Python 3.6.0. I used to use python in the command line to run Python 3.5.2 from the command line, and py to run Python 2.7.12. Now, python runs Python 3.5.2, and py runs Python 3.6.0. I am running Windows 10, and python3, python2, py2, and py3 do not do anything.
1 Answer
Don't bother adding Python to the path. Just use:
py Run highest version of Python (override with PY_PTYHON environment variable).
py -2 Run highest version of Python 2.
py -3 Run highest verssion of Python 3.
py -2.7 Run Python 2.7.
py -2.7-32 Run python 2.7 32-bit when on a 64-bit system.
More: https://docs.python.org/3.6/using/windows.html#python-launcher-for-windows
Note you can also specify in scripts which version to use as well with, for example:
#!python2
#!python3
#!python2.7
1 Comment
Eryk Sun
Note that if you're using the old, pre-3.6 version of the launcher, it defaults to running the highest version of Python 2, if installed, and otherwise the highest version of Python 3. This was changed in 3.6 to prefer Python 3. However, for virtual shebangs in scripts, such as
#!python and #!/usr/bin/python, the new version of the launcher still maps "python" to Python 2 for the sake of Unix compatibility.
py -2. To make this the default, set the environment variablePY_PYTHON=2.