When I use the Centos7-mini,centos system itself is installed by default python2.x, version x according to different versions of the system, you can see Python--v or Python--version The system comes with the Python version
There are some system commands need to use Python2, can not uninstall
1. Install dependent packages
1) First install the GCC compiler, gcc some system versions have been installed by default, through the GCC--version view, not installed first installed gcc,yum-y install GCC
2) Install other dependent packages, (note: Do not be missing, otherwise it may be possible to install Python error, python3.7.0 the following version can not be installed Libffi-devel)
Yum Install bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel Libpcap-devel Xz-devel Libffi-devel
2, download python3.7.0 source code, download according to demand
1) Select the Python source package you need in https://www.python.org/ftp/python/, I downloaded the python3.7.0
2) Download
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
3, Decompression python-3.7.0.tgz
tar -zxvf python-3.7. 0. tgz
4. Create an empty folder for storing Python3 programs
Mkdir
5. Execute configuration file, compile, compile and install
CD python-3.7. 0 . /configure--prefix=/usr/local/python3make make andinstall
Installation completed without prompting for error installation succeeded
7. Establishing a soft connection
Ln -s/usr/local/python3/bin/python3. 7 /usr/bin/python3ln -S/USR/LOCAL/PYTHON3/BIN/PIP3. 7 /USR/BIN/PIP3
8, test whether Python3 can be used
[Email protected] python-3.7.0]# Python3python3.7.0(Default, Jul - 2018, A: -: in) [GCC4.8.5 20150623(Red Hat4.8.5- -)] on Linuxtype" Help","Copyright","credits"Or"License" for Moreinformation.>>> Print ("Hello world!") Hello World!>>>exit () [[email protected] Python-3.7.0]# PIP3--Versionpip10.0.1From/usr/local/python3/lib/python3.7/site-packages/pip (python3.7)
You can see that python3.7.0 can be used normally
Linux installation python3.7.0