Switch Python2 and Python3 versions via cmd under "Turn" windows

Source: Internet
Author: User

When Python2 and Python3 are installed at the same time in the computer, it is often the need to switch versions. So how do you do it with the cmd command line?
Method: Modify the file name of the Python.exe

Give me a chestnut:

Both py2.7.10 and python3.4.3 are installed in My computer, and the following paths are added to the path path of the system environment variable, which is configured with the environment variables:

E:\python2.7.10_64\;E:\python2.7.10_64\Scripts;E:\python3.4.3\;E:\python3.4.3\Scripts;
    • 1
    • 2
    • 3

The two paths point to the Python installation directory E:\python2.7.10_64 and E:\python3.4.3, respectively, such as:

    1. If I want to use the Python3 version, just rename the Python.exe in the Python2 installation directory to Python2.exe, such as:

When I enter "python–version" in command line cmd, I see that I have switched to the Python3 version, such as:


2. If I want to use the Python2 version, simply rename the Python.exe in the Python3 installation directory to Python3.exe, such as:

When I enter "python–version" in command line cmd, I see that I have switched to the Python2 version, such as:

Note points for using the PS:PIP command:
(1). When only Python2 or Python3 are installed, use PIP

(2) When installing both Python2 and Python3:
Python2 using PIP2

Python3 using PIP3

Switch Python2 and Python3 versions via cmd under "Turn" windows

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.