Teach you how to install python2 and python3 versions in Windows environment

Y2J
Release: 2017-04-22 09:20:56
Original
3234 people have browsed it

This article mainly introduces the installation of python2.x and python3.x in Windows (I use Win10) environment, as well as the configuration issues when python2.x and python3.x coexist.

Nowadays, the commonly used desktop operating systems are: Windows, Mac OS, and ubuntu. Both Mac OS and ubuntu come with python. Here we only introduce the installation of python2.x and python3.x in Windows (I use Win10) environment, as well as the configuration issues when python2.x and python3.x coexist.

1. python download:

Download address: www.python.org

Teach you how to install python2 and python3 versions in Windows environment

This is the installation package of the latest version of python 2.x and python 3.x that I downloaded

Teach you how to install python2 and python3 versions in Windows environmentTeach you how to install python2 and python3 versions in Windows environment

2. Install python 2.x

Double-click python-2.7.12.amd64.msi and then click Next.

It should be noted that python 2.x is installed in the root directory of drive C by default, which is very easy to find. Therefore, when we install python 3.x, it is also recommended to install it in the root directory of drive C.

Teach you how to install python2 and python3 versions in Windows environment

3. Install python 3.x

Choose a custom installation here because you need to modify the default Installation location. In addition, the "Add Python 3.5 to PATH" option is checked here, which will automatically configure the environment variables, while python 2.x requires us to configure it manually, which is explained below.

Teach you how to install python2 and python3 versions in Windows environment

Check "Install for all users" here and customize the installation path to "C:\Python35"

Teach you how to install python2 and python3 versions in Windows environment

4. Current problems

As can be seen from the figure below, only python 3.x is configured in the current path environment variable, and the default python command is executed. It's also python 3.x.

Teach you how to install python2 and python3 versions in Windows environment

Therefore, there are two things we have to solve now:

  1. ##Configure the environment variables of python 2.x;

  2. To distinguish the related commands of python 2.x and python 3.x;

5. Configure python 2.x environment variables;

Here you need to add two directories to the path environment variable:

  1. The directory where the python command file is located : python 2.x installation directory

  2. The directory where other script files such as pip and easy_install are located: The scripts directory under the python 2.x installation directory

Operation steps: Right-click My Computer/This Computer--> Properties--> Advanced System Settings--> Advanced Tab (Default)--> Environment Variables--> Path under System Environment Variables -->Edit

Teach you how to install python2 and python3 versions in Windows environment

Add the following line to the beginning of the Path variable: C:\Python27;C:\Python27\scripts;

The end is like this:

Teach you how to install python2 and python3 versions in Windows environment

6. Distinguish the related commands of python 2.x and python 3.x;

The solution is: add a 3 after all command file names under python 3.x, such as: python ==> python3

Teach you how to install python2 and python3 versions in Windows environment

Teach you how to install python2 and python3 versions in Windows environment

7. Test:

Note: Be sure to restart the command terminal, otherwise the path variable will not be reset load.

Teach you how to install python2 and python3 versions in Windows environment

The test found that there is a problem with pip3. In fact, the version of pip is too low. Just upgrade it: python3 -m pip install -U pip

Teach you how to install python2 and python3 versions in Windows environment

Everything seems to be OK!

8. Selection of Integrated Development Tools

The ancients said, "If a worker wants to do his job well, he must first sharpen his tools." Choose a suitable tool. Development tools can help us improve work efficiency. Usually there are several tools to choose from:

  1. Pure file tools: There are no prompts, you need to write the code manually, and compilation and running also need to be done manually, such as Notepad;

  2. Simple GUI development tools: There are simple prompts, but compilation and running still need to be done manually, such as notepad++;

  3. Advanced GUI tools: There are prompts, And the compilation and running process is automatically completed by development tools, such as eclipse, Pycharm

Some people think that when just starting to learn a programming language, you should use simple tools like Notepad or notepad++. Reduce dependence on advanced GUI development tools, so that you can more clearly understand the underlying operating processes and principles of languages ​​that are blocked by development tools. But this depends on the individual. For example, I think that if a novice uses development tools without any prompts at the beginning, it will reduce the efficiency of practice and even further undermine self-confidence and motivation to learn. If you are afraid of it from the beginning, it will be difficult to learn it well in the future.

Of course, the choice is up to the reader. The GUI tool recommended here for developing Python is Pycharm. The reasons are as follows:

  1. Cross-platform, basically the most commonly used tool now There are many corresponding versions of desktop operating systems that can be downloaded

  2. It is divided into community version and commercial version. The community version is free to use, but has fewer functions (completely enough for novices); the commercial version Full functionality, but requires payment.

Pycharm 2017 activation code

The code is as follows:

BIG3CLIK6F-eyJsaWNlbnNlSWQiOiJCSUczQ0xJSzZGIiwibGljZW5zZWVOYW1lIjoibGFuIHl1IiwiYXNzaWduZWVOYW1lIjoiIiwiYXNzaWduZWVFbWFpbCI6IiIsImxpY2Vuc2VSZXN0cmljdGlvbiI6IkZvciBlZHVjYXRpb25hbCB1c2Ugb25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IQbwrBA+c/F4tlK/DV07dsNExihqFoibnqpNTGombaU2dDup2gwKdL81ua8EIcGNExHe82kjF4zwfadHk3bQVvbfdAwxcDy4xBjs3L4raPLU3yenSzr/OEur1+jfOxnQSmEcMXKXgrAQ9U55gwjcOFKrgOxEdek/Sk1VfOjvS+nuM4eyEruFMfaZHzoQiuw4IqgGc45ohFH0UUyjYcuFxxDSU9lMCv8qdHKm+wnPRb0l9l5vXsCBDuhAGYD6ss+Ga+aDY6f/qXZuUCEUOH3QUNbbCUlviSz6+GiRnt1kA9N2Qachl+2yBfaqUqr8h7Z2gsx5LcIf5kYNsqJ0GavXTVyWh7PYiKX4bs354ZQLUwwa/cG++2+wNWP+HtBhVxMRNTdVhSm38AknZlD+PTAsWGu9GyLmhti2EnVwGybSD2Dxmhxk3IPCkhKAK+pl0eWYGZWG3tJ9mZ7SowcXLWDFAk0lRJnKGFMTggrWjV8GYpw5bq23VmIqqDLgkNzuoog==
Copy after login


The above is the detailed content of Teach you how to install python2 and python3 versions in Windows environment. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!