Scipy Weave - Compilation Error

New users of the python library Scipy may be having difficulty using the weave library which allows on the fly C++ compilation of python code. While trying to get this to work on Ubuntu, I was prompted with the following error:

scipy.weave.build_tools.CompileError: error: Command "g++ ..." failed with exit status 1

To fix this, I realised that I didn't have the python header files required (specifically Python.h). These can easily be installed on ubuntu by installing the python dev package:

sudo apt-get install python-dev