How to Install rdflib

At the Linked Data preconference at Code4Lib 2009 a couple of weeks ago, I learned about the rdflib Python library. Naturally, I wanted to install the library so I could mess with it on my own. That proved to be a little problematic, though. Following the installation instructions, I typed:

$ easy_install -U "rdflib>=2.4,<=3.0a"

And it very helpfully told me (among other things):

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes
-fPIC -I/usr/include/python2.5 -c src/bison/SPARQLParser.c -o
src/bison/SPARQLParser.c:7:20: error: Python.h: No such file or directory

As it turns out, I should have had python-dev and build-essential already installed. Being new to Linux, I did not know. Thanks, BenO, for helping me out with this.

The complete installation instructions:

$ apt-get install python-dev
$ apt-get install build-essential
$ easy_install "rdflib==2.4.0"