安装make、gcc mysql编译器命令
yum -y install openssl-devel zlib-devel gcc automake autoconf libtool make gcc gcc-c++ sql mysql mysql-server mysql-devel -y
下载安装包
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
解压安装包
tar -xvf Python-3.6.0.tgz
创建安装文件的路径
mkdir /usr/local/python3
编译
./configure --prefix=/usr/local/python3
执行安装命令
make && make install
创建python3的软连接
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
编译安装setuptools
下载安装包
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26
解压安装包
tar -zxvf setuptools-19.6.tar.gz
python3 setup.py build
python3 setup.py install
编译安装pip
下载安装包
wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb
解压安装包
tar -zxvf pip-8.0.2.tar.gz
python3 setup.py build
python3 setup.py install
测试是否可以使用pip
python3 -m pip install paramiko
配置pip环境变量 vi /etc/profile
PATH=$PATH:$HOME/bin
PATH=$PATH:$HOME/bin:/usr/local/python3/bin
安装Django
pip install Django==1.8.9
创建web应用
django-admin.py startproject HelloDjango
python manage.py migrate
启动
python3 manage.py runserver 192.168.0.3:80