Under Centos7.4 installation Python3

Installation Python3

Installation dependencies

yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

Download Python3

wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz

Create a directory

mkdir /usr/local/python3 

Decompress and install the package

tar -xvJf  Python-3.6.2.tar.xz
cd Python-3.6.2
./configure --prefix=/usr/local/python3
make && make install

Create a soft link

ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

Centos default have python2.7, can be opened by typing python python2 type python3 to open python3 interpreter

Guess you like

Origin www.cnblogs.com/ruhai/p/10995952.html