1、centos7默认python版本为2.7.5,现升级到3.6.0
2、wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
tar zxvf Python-3.6.0.tgz
cd Python-3.6.0/
./configure --prefix=/usr/local/python3
make
make install
mv /usr/bin/python /usr/bin/python2old
ln -s /usr/local/python3/bin/python3 /usr/bin/python
3、升级完成后yum会报错
编辑/usr/bin/yum,第一行/usr/bin/python改为/usr/bin/python2
编辑/usr/libexec/urlgrabber-ext-down,第一行/usr/bin/python改为/usr/bin/python2
4、python3默认已安装pip3,/usr/local/python3/bin/pip3 ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
5、安装Django,下载tar.gz包,解压运行python setup.py install,如果提示出错,则因缺少依赖导致,如缺少pytz,下载pytz的tar.gz包安装即可
6、如果执行python manger.py runserver包没有sqlite3模块,解决方法如下
7、下载sqlite,wget https://www.sqlite.org/2018/sqlite-autoconf-3260000.tar.gz
8、wget https://www.sqlite.org/2018/sqlite-autoconf-3260000.tar.gz ;cd sqlite-autoconf-3260000;./configure;make;make install
9、重新编译python