下载python3,进行编译安装,运行django程序
在 /opt目录中安装
1.解决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
2.下载python3源码包
wget https://www.python.org/ftp/python/3.6.7/Python-3.6.7.tar.xz
xz -d Python-3.6..tar.xz
tar -xf Python-3.6..tar #解压缩,生成一个python源码文件夹
3.进入python源码文件夹
4.进行编译安装,编译三步
.第一步
./configure --prefix=/opt/python36/
--prefix 参数解释:指定python36安装的位置
.第二步
make
.第三步 ,此时就开始安装python3软件
make install
5.进入python36安装目录 ,检查bin目录
6.配置python3的环境变量 PATH
.取出当前的path变量
echo $PATH
.填写python3的bin目录到PATH中(这步只是准备,不用写入)
PATH="/opt/python36/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin"
.将环境变量,写入到全局配置文件/etc/profile
vim /etc/profile
.写入如下代码,在最底行写入如下配置
PATH="/opt/python36/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin"
.读取配置文件,加载变量生效
source /etc/profile
7.安装django,运行django
.安装django模块
pip3 install -i https://pypi.douban.com/simple django
.升级pip
pip3 install --upgrade pip
.通过命令创建django项目
django-admin startproject crm
django-admin startapp app01
关闭防火墙
iptables -F
安装tree
yum install tree -y