How can I change default Python version on the cmd in Windows 10

13,753

For running Python 3 on your computer from the Command Prompt: enter py -3.6 myfile.py

For running Python 2.7: py -2.7 myfile.py

This also works if you have Python 3.4 and Python 3.6 installed, just change the argument.

Share:
13,753
Huy Tran
Author by

Huy Tran

Updated on July 26, 2022

Comments

  • Huy Tran
    Huy Tran over 1 year

    I have python v2.7 and 3.6 on Windows 10. I installed 3.6 later and also chose the option "Add to PATH". In the command line, when I type python, I get v3.6. I already tried to set PATH in View Advanced System Settings, but it doesn't work and python 3.6 is also no where to be found there. So when I want to set v2.7 as default (in order to run python script in the Atom Editor or the cmd), I have to reinstall v2.7 and ticked the "Add to PATH" option.

    How can I set my new default python version to use for example in a text editor or cmd... without having to reinstall it?