Python modules allow you to use code of others in your code. This saves you a lot of development time, you don’t have to reinvent the wheel each time.

There are two ways to install Python modules: system wide and using a virtual environment.

You may like:


We can create a virtual environemnt, that is seperate from the operating system. This allows you to use the same Python modules as other developers in your team.

Create a virtual environment with the line:

virtualenv foo

Then open /foo/

cd /foo/

You now have 3 directories: bin, include and lib.
Move up a directory.
To activate the virtual environment type:

source foo/bin/activate

we can then install any module, any version we want - without affecting the operating system. This way we can have the same version of modules as other developers.

Note: Pip will now install for this environment only.

To exit the virtual environment write:


System wide

To install a module system wide, use pip and type

sudo pip install module-name

That will install a Python module automatically. Generally you do not install modules system wide.