Setup pip and virtualenv

Tutorial ButtonHaving trouble with the mission? Read how to get help.

Using pip and virtualenv

About pip

Python code that is not a part of the
Python Standard Library
is commonly released in the form of packages. As these packages are
not a part of the standard library, we use tools like pip to download
and install these ‘third-party’ packages. Using pip, we can install
code other developers have written and use it in our own projects.

pip is
a package management system used to install and manage third-party
software packages written in Python. pip stands for “python install python”.
Many packages can be found in the
Python Package Index (PyPI)
.

About virtualenv/virtualenvwrapper


The Hitchhiker’s Guide to Python!
gives a good explanation
of what a Virtual Environment actually is, in

its section about virtual environments
:

A Virtual Environment, put simply, is an isolated working
copy of Python which allows you to work on a specific project without
worry of affecting other projects.

For example, you can work on a project which requires
Django 1.3 while also maintaining a project which requires Django 1.0.

virtualenv
is a tool that allows you to create isolated Python environments.

virtualenvwrapper
is simply a wrapper around virtualenv and it
provides a set of intuitive commands that make it easier to work with
virtual environments. It also does the job of putting all of your
virtual environments in one place.

To summarize, virtual environments are responsible for preventing
different versions of the same software from interfering with each other,
thus, leaving you free to work on more than one project at a time without
worrying about any kind of conflicts.

What you’ll learn

After completing this mission, you will be able to install,
manage and remove third-party Python packages using pip and create
and work with isolated Python environments using virtualenv and
virtualenvwrapper.

Getting started

This mission consists of five parts: setting up pip and
virtualenv, creating virtual environments and installing packages,
removing packages and deactivating virtual environments, learning
more about pip and virtualenv, and a quick reference at the end.