centos7 安装python3

1,安装依赖包

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

2,下载python3源码

wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz

3,解压,常规安装

tar zxvf Python-3.6.5.tgz
cd Python-3.6.5
mkdir /usr/local/python3
./configure --prefix=/usr/local/python3
make && make install

4,建立软链接

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

发表评论

电子邮件地址不会被公开。 必填项已用*标注