#yum
yum groupinstall "Development tools"
yum install gcc wget openssl-static zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
# 下载python
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
# 解压
tar -xvf Python-3.6.1.tar.xz
# 进入Python-3.6.1目录
cd Python-3.6.1/
# 安装编译
./configure --prefix=/usr/local/python3
make
make install
# 建立软连
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
# 查看版本
python3 -m pip -V
pip3 -V
# 切换源
mkdir ~/.pip
vim ~/.pip/pip.conf
[global]
index-url=http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
# 安装依赖
pip3 install -r requirements.txt
# 快速生成requirement.txt的安装文件
pip3 freeze > requirements.txt