virtualenv 及 django 安装注意事项
【注意Python的版本】
Python版本为2.x时,pip 安装 Django 为1.x版本,DJango 2.x 只支持 3.x 版本Python
【将系统默认Python修改为Python 3.x】
使用 whois 查询Python2 Python3 安装位置,这里假设系统为Ubuntu 16.04,默认python命令对应python 2.7,python3 命令对应python3.x。可执行Python,进入Python解释器查看Python版本
如下图所示,3.6.5 为Python的版本
1 (django) changmen7@CGNU:~/mblog$ python 2 Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56) 3 [GCC 7.2.0] on linux 4 Type "help", "copyright", "credits" or "license" for more information. 5 >>>
mv /usr/bin/python /usr/bin/python2 备份python命令
ln -s /usr/bin/python3 /usr/bin/python 创建链接