centos安装python3.7

准备工作

准备gcc环境和其他依赖包【python3.7以上的需要】

1.yum -y install gcc

2.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 libffi-devel

 

开始安装

1.下载安装包

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

 

2.解压安装包

tar -zxvf Python-3.7.3.tgz

 

3.新建文件夹,存储python3.7.3整个环境

mkdir /usr/local/python3

 

4.进入刚才解压的3.7.3文件夹

cd Python-3.7.3

 

5.开始进行编译

./configure --prefix=/usr/local/python3

make && make install

 

6.查看环境变量

cd /usr/bin

ll python*

 

7.建立软链接[不能建立和原有环境变量冲突的链接]

ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3

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

 

8.输入python3验证

 

posted @ 2020-03-27 16:04  python_snowwhite  阅读(712)  评论(0编辑  收藏  举报