Win7 and Win10 Python3 and Python2 simultaneously install and resolve PIP coexistence issues

Source: Internet
Author: User

In particular , this article is carried out under the Windows64 bit system , 32-bit system please download the corresponding version of the installation package, the installation method is similar.

Using Python development, the environment has Python2 and python3 two kinds, sometimes need two kinds of environment switch use, below provides a detailed tutorial a copy.

1. Download Python3 and Python2

Go to Python website, link https://www.python.org/

Select Downloads--->windows, click Enter to see the Python version you are looking for

This article has chosen:

Python3.5.2, click on the link below to download directly, Https://www.python.org/ftp/python/3.5.2/python-3.5.2rc1-amd64.exe

Python2.7.9, click on the link below to download directly, Https://www.python.org/ftp/python/2.7.9/python-2.7.9.amd64.msi

2, Python3 installation

Note: This article installs Python3 first, then installs the Python2

First select the installation directory, the installation path of this article is D:\Python\python35, and then click on the download of the Python3 package for installation, the specific process is as follows:

In the red flag where add Python3.5 to path is checked, you can add python3 directly to the system environment variable, and then customize the installation path in Customize installation.

Direct Next

In the advanced options, there is no default tick to tick according to your needs, yellow labeled vs 2015 and later, if you intend to configure the Python environment in VS 2015, check this option, click Browse to select the installation directory, Then click Install for installation.


Wait for the following installation process


Installation Successful


Click Close, view Python3 installation, press "Win + R" shortcut, in the Open "Run" dialog box, enter "cmd" press ENTER, enter the following interface, enter Python to view Python3 installation, display Python 3.5.2 version information, the installation is successful, You can enter the statement print (1 + 1) to test.

The final step is to find the Python3 idle installation location and send a shortcut to the desktop


Open the python3.5.2 shell interface and you'll be able to develop Python.

3, Python2 installation

Click Python2 Install package, click Run, Next, select the installation directory, this article installs the path to D:\Python\python27, then next

Yellow circled out of the section, the display can not add the path to the system variables, can not directly use the Python command does not matter, first click Next to install, followed by a dedicated solution.

Click Finish to complete the installation.

At this point, Python2 and Python3 are installed.

Special note: Run the "cmd" command at this time to enter the DOS command Prompt box, enter Python still display Python3 version, next refer to this series tutorial two.

4. Add Python2 to System environment variables

Open, Control Panel \ System and Security \ System, select Advanced system settings, environment variables, select Path, click Edit, New, add D:\Python\python27 and D:\Python\python27\Scripts to environment variables respectively.

Note:The Python3 installation can optionally be automatically added to the system environment variable, as is not selected, and the method is the same as the Python2 add process.

5, modified Python.exe name for Python2.exe and Python3.exe

Locate the installation directories for Python2 and Python3, modify the Python.exe and Pythonw.exe names in python2.7.9 and python3.5.2 Python2.exe, Pythonw2.exe and Python3.exe, Pythonw3.exe.

Then run the cmd command and enter Python2 to run the python2.7.9 version

Enter Python3 to run the python3.5.2 version

At this point, Python2 and Python3 are installed.

6, PIP2 and PIP3 settings

The Python installation package requires the Package management tool PIP, but when both Python2 and Python3 are installed, Pip is just one of the versions, and the following will provide a way to modify the two-version Pip so that the two Python versions of PIP can coexist.

In the DOS command box, enter the command, python3-m pip install--upgrade pip--force-reinstall, to show that the reinstallation was successful.

In the DOS command box, enter the command, python2-m pip install--upgrade pip--force-reinstall, to show that the reinstallation was successful.

The two versions of PIP information can now be viewed through pip2-v and pip3-v, with the ability to install their own Python packages later by running Pip2install xxx and pip3 install XXX.

At this point, PIP2 and PIP3 modified successfully.

Reprint: http://www.cnblogs.com/thunderLL/p/6643022.html

Win7 and Win10 Python3 and Python2 simultaneously install and resolve PIP coexistence issues

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.