Install both Python2 and Python3 under Windows

Source: Internet
Author: User

I used to use 2.7 more when I studied.

Want to Practice 3.7 times, two version compatibility issues, distressed for a few days.

Looked up the information and found a good way. Record it and do a share.

This article is mainly about how to install both Python2 and Python3 on the same computer, and PIP can be used normally.

Many of the posts, given the solution, are in the root directory, the Python.exe and Pip.exe file name modified.

But such a method is still not perfect. The version of PIP is prone to conflict and often results in only one pip to use.

There was an unexpected discovery today of another method.

Python installation, reference article: http://www.cnblogs.com/zhengyihan1216/p/6011640.html

The official gave us a perfect solution!!!

That's py.exe!.

Py.exe as an initiator, he exists in the Python3 version of the installation package. Default storage path such as.

This file will be available as long as you have more than 3 Python versions installed on your PC.

Specific Use method:

Start Python2:

Start Python3:

Pip is also launched in the same way as the start Python, which corresponds to Python2 and Python3, respectively.

This is a bit of a hassle when running Python files, and the workaround is that we can declare the Python version in the file header, declaring the following format:

One thing to note here is that the Python version declaration is to be placed first.

Install both Python2 and Python3 under 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.