Django 2 by Example
上QQ阅读APP看书,第一时间看更新

Installing Django with pip

The pip package management system is the preferred method for installing Django. Python 3.6 comes with pip preinstalled, but you can find pip installation instructions at https://pip.pypa.io/en/stable/installing/.

Run the following command at the shell prompt to install Django with pip:

pip install Django==2.0.5

Django will be installed in the Python site-packages/ directory of your virtual environment.

Now, check whether Django has been successfully installed. Run python on a terminal, import Django, and check its version, as follows:

>>> import django
>>> django.get_version()
'2.0.5'

If you get the preceding output, Django has been successfully installed on your machine.

Django can be installed in several other ways. You can find a complete installation guide at https://docs.djangoproject.com/en/2.0/topics/install/.