Version Declaration
centos7.4
The Python on Linux is version 2 by default, and the Django Project is a 3 version, so we have to upgrade to the next version.
1. Download python3.6.5
cd/usr/local/
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
TAR-XVF python-3.6.5.tgz extracted directory renamed MV Python-3.6.5 python36
2. Install, directory settings yourself decompression
./configure--prefix=/usr/local/python36
Make
Make install
Or
Direct make && make install
If the error zipimport. Zipimporterror:can ' t decompress data uses yum-y install zlib* installation related dependencies, then make && make install
mv/usr/bin/python/usr/bin/python2.6.6 the previous version to expire
Add a new version of Python's soft connection to the/usr/bin directory
Ln-s/usr/local/python36/bin/python3.6/usr/bin/python
Adding the version python3.6.5 command to an environment variable
Vim/etc/profile
Export path= $PATH:/usr/local/python36/bin This sentence is added to the bottom of the file.
Source/etc/profile #刷新配置
That's it!
Of course not ~ ~ you will find Yum bad, because Yum is based on Python, and then Python3 is loaded, but for some reason can not find (specific Baidu bar), so the solution is as follows:
Vi/usr/bin/yum
#!/usr/bin/python modified into #!/usr/bin/python2.6.6
Yum performs validation
That's OK.
This time, there are two versions of Python, but the default is Python3
Using the Python3 installation library
PIP3 Install XXX
Download using Python2
Pip Install xxx
~~~~~~~~~~~~~~~~~~~~ is finished ~~~~~~~~~~~~~~~~~~~~~~~~~~
[linux]centos7.4 upgrade Python2 version to python3.6.5 "Install dual version, default Python3"