centos7 安装升级python3.7

centos7 安装升级python3.7

Scroll Down

1、安装相关编译包

yum install zlib-devel bzip2-devel  libffi-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make -y

2、下载python 文件

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

3、解压

tar -xvf Python-3.7.2.tar.gz

4、进入目录

cd Python-3.7.2

5、编译安装

./configure prefix=/usr/local/python3

	make && make install

6、添加软链到执行目录下/usr/bin

mv /usr/bin/python /usr/bin/python27
	ln -s /usr/local/python3/bin/python3 /usr/bin/python

7、验证python是否成功安装

python -V

8、pip添加软连接

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