Ubuntu 16.04 LTS Django虚拟开发环境配置

时间:2023-01-21 19:15:21

操作系统:Ubuntu 16.04 LTS 

注意:系统自带2个版本的python,一个是python2.7,一个是python3.5,我只需要在python3.5下安装venv虚拟环境

shell命令:

sudo apt-get install python3-venv

然后,等待安装结束,在shell执行命令:

~$ python3 -m venv DjangoENV
~$ cd DjangoENV/
~$ source bin/activate

进入venv虚拟环境,很干净,清爽,接着执行shell命令:

(DjangoENV) warlock921@warlock921-desktop:~$ pip3 list
Django (
1.11.5)
pip (
8.1.1)
pkg
-resources (0.0.0)
pytz (
2017.2)
setuptools (
20.7.0)
(DjangoENV) warlock921@warlock921
-desktop:~$

开始安装django,shell命令:

(DjangoENV) warlock921@warlock921-desktop:~/DjangoENV$ pip3 install django
Collecting django
Downloading https:
//pypi.doubanio.com/packages/18/2d/b477232dd619d81766064cd07ba5b35e956ff8a8c5c5d41754e0392b96e3/Django-1.11.5-py2.py3-none-any.whl (6.9MB)
100% |████████████████████████████████| 7.0MB 12.1MB/s
Collecting pytz (from django)
Downloading https:
//pypi.doubanio.com/packages/55/62/e7cd0e15b76062d298413f14bb4ec3cd8568a22d274427f9c3c7286969f4/pytz-2017.2-py2.py3-none-any.whl (484kB)
100% |████████████████████████████████| 491kB 5.5MB/s
Installing collected packages: pytz, django
Successfully installed django
-1.11.5 pytz-2017.2

安装完成,大功告成!