前言
使用AWS中的Redhat实例搭建Django项目时,发现AWS自带yum源中未包含python3相关rpm包,故撰此文
正文
- 下载与解压
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
tar zxvf Python-3.6.5.tgz
- 编译
cd Python-3.6.5
sudo yum install gcc
./configure --prefix=/opt/python3
make
- 安装
sudo yum install openssl-devel
sudo make install
- 检查安装是否成功
which python3 # /usr/local/bin/python3
which pip3 # /usr/local/bin/pip3
- 安装虚环境
初次接触虚环境的请自行科普
sudo /usr/local/bin/pip3 install virtualenv