centos安装python3

centos自带的python是2.7的,但是2.7python已经逐渐被抛弃,纷纷转到python3le。故记录下centos安装python3的流程

先安装依赖包

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

下载python3的包

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

解压并安装

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

创建软链接

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

你可能感兴趣的:(centos安装python3)