简体   繁体   中英

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

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?

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.

Easy solution. My last installation was python 3.6 (folder name Python36-32). I just changed folder name to something like Python36-32- and now python 2.7 running.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM