ubuntu合两个版本的python ,同时又python2 和python3

当前系统版本

terry@vUBox:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:        16.04
Codename:       xenial

1.启动python2

terry@vUBox:~$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "cophuyright", "credits" or "license" for more information.
>>>
2.如果要启动python3
输入pyhthon3
terry@vUBox:~$ python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

安装django

python2 使用django

sudo apt-get install python-django -y

如果要在python3 中调用django,django安装命令

sudo apt-get install python3-django -y
terry@vUBox:~$ python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> print(django.get_version())
1.8.7
>>>