If you aren t able to enter a Python interactive session, review the Python installati
on process because you will not be able to continue with the following sections.
Update or Install pip Package Manager (Prerequisite)
To make Python package installation and management easier, Python uses a
package manager called pip. If you re using Python 2.7.9 (or greater 2.x bran
ch) or Python 3.4 (or a greater 3.x branch), pip comes installed by default. No
w let s upgrade pip on your system as shown in Listing 1-2, if you don t hav
e pip on your system, I ll provide instructions shortly on how to get it.
Listing 1-2. Update pip package man
ager [ user @~] $ pi p i nst al l - - upgr
ade pi p Col l ect i ng pi p
Downl oadi ng pi p- 9. 0. 1- py 2. py 3- none- any. whl ( 1.
3MB) I nst al l i ng col l ect ed packages: pi p
Found exi st i ng i nst al l at i on: pi p 8. 1.
1 Successf ul l y i nst al l ed pi p- 9. 0. 1
As you can see in Listing 1-2, to update pip you invoke the pi p executable wi
th the arguments instal l- - upgr ade pi p. Upon execution, pip searches for a p
ackage by the provided name - in this case pip itself - downloads it and perfor
ms an upgrade in case it s already installed. If the installation output on your
system is similar to the one in Listing 1-2 - without any errors - you have succ
essfully updated pip.
If you see an error like The program pip „ is currently not installed or pip not fo
und, it means your Python installation is not equipped with pip. In this case, y
ou ll need to install the pip executable by downloading ht t ps: / / boot st rap.
pypa. i o/ get - pi p. py and then executing the downloaded file with the comm
and: python get - pi p. py. Once the pip executable is installed, run the pip upd
ate procedure from Listing 1-2.With pip on your system, you re ready to move
on to the next step.
Install virtualenv (Optional Prerequisite)
Virtualenv is not essential to develop Django applications, but I highly recom
mend you use it because it allows you to create virtual Python environments
on a single system. By using virtual Python environments, applications can ru
n in their own
sandbox „ in isolation of other Python applications. Initially virtualenv can app
ear to be of little benefit, but it can be of tremendous help for tasks like repli
cating a development environment to a production environment and avoiding v
ersion conflicts that can arise between different applications.
Without virtualenv you can still proceed to install Django and any other Python pac
kage using pip, but the issue is that all packages are installed under the global Py
thon installation. Initially this can seem convenient, because you only need to