How to switch Python2.7 and Python3.6 in the CMD Command window under Windows system

Source: Internet
Author: User

We may have multiple versions of Python installed under the same system, After all Python2.7 and Python3.6 still have different needs, but in the cmd command window is we may default system variable environment is one of the version, when we need to operate in the CMD Command window to another version, I had to change the system environment variables Python2.7 and Pyth on3.6 position before and after order, so that the location of the temporarily needed version is in the front of the environment variable .... But ~ ~ This is not a good way to worry, finally in today, I get to a new approach, and now feel good.

==================== below into the body =================

For two different versions of Python, we can put the default Python2.7->python, and Python3.6->python3, which requires us to rename the Python.exe under the Python installation directory.




(In this case, in cmd, Python defaults to Python2.7, while Python3 stands for Python3.5)

Effect:

Additional Instructions:

For different versions of the installation module, you can view the PIP under the installation path C:\Python27\Scripts


By modifying the first line of the pip*-script.py file, point to a different python.exe
For example, let PIP3 and pip3.5 both target the python3.6 version, then change the first line to #!c:\python36\python3.exe,如果提示找不到pip3-script.py,请重新copy pip-script.py  --》 pip3-script.py

pip2.7 default for python2.7 version is Python.exe (because the interpreter in Python27 is still python.exe)

Results after modification:


Note the difference between the PIP3, the former is not modified, the default point to python2.7, the latter is modified to point to python3.6

How to switch Python2.7 and Python3.6 in the CMD Command window under Windows system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.