Software that needs to be installed:
Python2.7.14 and Python3.6.4 to install two versions at the same time on a computer
Development tools: Pycharm is a jetbrains python development tool One of the idea series
Python version: Two different versions of 2.X and 3.X
Now there are two versions of my Windows computer, Python 3.6.4 and Python 2.7.14
Enter Python under Windows command line, the default is Python 3.6.4 this version, want to do 2 version I set to need input Python2
Install Python
Python installation package official website: https://www.python.org/downloads/
Select the version you want to install to download the installation package
python-(here is the version number, such as 2.7.14). msi is the installation version of Windows
Install after download, for those who do not want to install the default path, you can choose the non-system disk as your own installation path. Like mine is D:\Python.
The next step is to configure the environment variables (images are intercepted by the Web address: HTTPS://WWW.JIANSHU.COM/P/0BD0BC73EFF2)
Python automatically sets the Python path to the path system environment variable at installation time. As below
If you enter Python in cmd, the Python interface is entered, and the Python installation is complete.
No, we'll manually add our Python installation path to the system environment variable (not Baidu)
The installation to this single python has been completed. The installation of the following python3 can be omitted without installing the two versions
We are going to finish installing the 2.x and 3.x versions of the Windows PC, we continue to download Python 3.6.4.exe via Python's official website (it's curious how the 2.7 version of MSI file 3.6 becomes an EXE file)
Download Complete installation, IBID.
It is possible to output or python2.7 version information when you enter Python on the command line after the installation is complete. First, we need to confirm what version of Python we need to use by default. It's assumed to be python3.x.
We get the installation path for 3.6.4 and 2.7.14 separately (note the path to the installation is not mistaken)
Notice the red circle above. The installation path of my python2.7.14 D:\Python\ my python3.6.4 installation path is D:\Python3\
We open the environment variable (My Computer--right---Properties--advanced--environment variable) add information to the system variable PATH variable
Such as:
In the value of the path variable, delete the existing Python-related path first.
At the back of this add
;D: \python3\;D: \python3\scripts\;D: \python\;D: \python\scripts\
Put the path of the Python3 in front, and then we modify the Python.exe file in the python2.7.14 directory to rename to Python2.exe
After Setup, we re-cmd path input python display is the default python3.6.4 information,
If we're going to use python2.7.14, we'll enter Python2.
(now that the Python name is entered, the system looks for the value of the variable in the path, that is, to find the value of the variable, there is no python.exe executable in all paths, and then it runs without returning an error message)
If we want to use python2.7.14 by default, we just need to rename the Python.exe in the Python3 installation path to Python.exe in the Python3.exe,python2 installation path without modifying the name Python2.exe
This completes the coexistence of Python2 and 3.
But there is still a problem, when we do PIP installation module, we do not know whether to use Python2 or Python3 installation
And after we configure the environment variable, enter PIP,PIP2 or PIP3 on the cmd command line
will report an error
Fatal error in launcher:unable to create process using ' "'
At this time we need to python2 and python3 corresponding to the scripts directory under the Pip.exe file to delete. Close the DOS window, re-open input PIP3 and PIP2 can be entered
If we python2 to install the module, you should use PIP2 install the name of the software you want
If you want to install in Python3, you can use PIP3
python2.x and python3.x Coexistence installation configuration completed
Install pycharm Baidu Search, find the corresponding official website to download the installation.
Python Development Environment Installation configuration