Windows Next python3 and python2 How can we install it at the same time python3 Follow python2 Well
1、 download python3 and python2 install
Get into python Official website , link [https://www.python.org/](https://link.jianshu.com?t=https://www.python.org/)
choice Downloads--->Windows, Click enter to see what you want python edition
This article chooses :
Python3.5.2, Click the following link to download directly ,[https://www.python.org/ftp/python/3.5.2/python-3.5.2rc1-amd64.exe](https://link.jianshu.com?t=https://www.python.org/ftp/python/3.5.2/python-3.5.2rc1-amd64.exe)
Python2.7.9, Click the following link to download directly ,[https://www.python.org/ftp/python/2.7.9/python-2.7.9.amd64.msi](https://link.jianshu.com?t=https://www.python.org/ftp/python/2.7.9/python-2.7.9.amd64.msi)
2、python3 install
explain : This article first installs python3, Then install python2
First select the installation directory , The installation path of this article is C:\python35, Then click on the downloaded python3 Package to install , The specific process is as follows :
In the place marked in red in the figure below Add Python3.5 to PATH Check before , You can directly python3 Add to system environment variable , And then in Customize installation Custom installation path in .
3、python2 install
Click on python2 Installation package , Click on the run ,next, Select the installation directory , The installation path of this article is C:\python27, then next
Click on finish Complete the installation .
thus ,python2 and python3 Installation completed .
4.python2.exe、python3.exe and pip2、pip3 Set up
1、 add to python2 To system environment variables
open , Control panel \ Systems and security \ System , Select advanced system settings , environment variable , choice Path, Click edit , newly build , Add respectively D:\Python\python27 and D:\Python\python27\Scripts To environment variable .
Be careful :python3 You can choose to automatically add to the system environment variable during installation , If you don't choose , Methods and python2 The addition process is the same .
2、 modify python.exe The name is python2.exe and python3.exe
find python2 and python3 Installation directory , modify python2.7.9 and python3.5.2 in python.exe and pythonw.exe For the name of the python2.exe、pythonw2.exe and python3.exe、pythonw3.exe.
And then it's running cmd command , Input python2 You can run python2.7.9 edition
Input python3 You can run python3.5.2 edition
3、pip2 and pip3 Set up
Python Package management tools are required for package installation pip, But when installed at the same time python2 and python3 When ,pip Just one version , Here is a way to modify , That is, reinstall both versions of pip, Make two python Version of pip Can coexist .
stay DOS Command box enter command ,python3 -m pip install --upgrade pip --force-reinstall, Show successful reinstallation .
Now you can go through pip2 -V and pip3-V Check out two versions of pip Information , In the future, just run pip2install XXX and pip3 install XXX You can install your own python package
thus ,pip2 and pip3 Modification successful .