centos7 安装Python3并配置环境变量亲测有效
python官网(linux下载地址、版本可自选):https://www.python.org/ftp/python/
一、添加阿里云第三方扩展源仓库(安装拓展源仓库才能安装yum 安装 openssl11 openssl11-devel,python源码编译必须要openssl11 或以上版本)
备注,我这里是把pyhton安装包放在 /usr/local/目录下
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum makecache
如果执行yum makecache这条命令出现很多Errot 503 还有 Error 404说明没执行成功,如下
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
或者curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
需要更换yum镜像源后再次执行yum makecache命令
Tips:复制命令的时候提前把撰写窗口打开(查看–撰写–撰写窗口),先复制到撰写窗口里面,再复制到命令行不容易出错
二、安装依赖
yum -y install openssl-devel openssl11 openssl11-devel libffi-devel
yum -y install wget zlib zilb-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make xz-devel libd