1. 下载python源码
wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz
2. 安装python的工具包解决环境依赖
yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y
3. 解压缩源码包
tar -xvf Python-3.6.2.tgz
4.切换到解压缩的目录 并且编译释放 --prefix释放的文件路径
./configure --prefix=/opt/
5.编译且安装
开始编译运行 make
编译后再安装 make install
6.将python添加到环境变量中
vim /etc/profile
再最底层写入
PATH=之前的路径:/opt/python36/bin
重新读取配置文件
source /etc/profile
7.借助豆瓣的源下载Django
pip3 install http://pypi.douban.com/simple django