centos7安装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

安装目录

mkdir /usr/local/python3 

下载安装包  

cd /usr/local/python3
wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tar.xz

解压安装包

tar -xvJf  Python-3.6.6.tar.xz

安装

cd Python-3.6.6
./configure --prefix=/usr/local/python3
make && make install

创建软链接

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

 

你可能感兴趣的:(CentOS,python,python,centos)