1.下载linux版本的Python3.6.6安装包
- wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz
2.解压到指定目录
- tar -zxvf Python-3.6.6.tgz -C /opt/module
3.安装必要组件
- yum install gc -y
- yum install openssl-devel -y
- yum install sqlite-devel -y
- yum install -y gcc
4.安装
- cd Python-3.6.6
- ./configure --prefix=/opt/module/python36
- make
- make install
5.软连接
- ln -s /opt/module/python36/bin/python3.6 /usr/bin/python3
- ln -s /opt/module/python36/bin/pip3 /usr/bin/pip3
6.配置环境变量
eg:环境变量需要配置在/etc/profile文件中所有其他配置的前面