Getting the RDFLib python library dev environment set up

authored by Frank Lynam at 05/02/2013 10:50:48

This post records how I got the RDFLib python library up and running in my Ubuntu development environment.

My system setup is as follows:

  • Ubuntu v12.04.1 LTS
  • Eclipse 4.2.1
  • Python 2.7
    • note that python3 is installed in the /usr/lib folder but doesn't seem to be used by Eclipse.
    • perhaps this can be changed easily in the includes in Eclipse?
  • RDFLib 3.4.0
    • I initially copied the download directory over to /opt and ran easy-install
    • But then I noticed that it had been added to the /usr/local/lib/python2.7/dist-packages/ folder. This probably happened during the install.
    • I then deleted the /opt folder

Having set all this up I tried to run some code:


import rdflib
g=rdflib.Graph()
g.load('http://dbpedia.org/resource/Semantic_Web')

for s,p,o in g: 
  print s,p,o

It ran fine but I was getting an error in Eclipse saying that rdflib was unknown. I opened up the properties dialog for the project and added the usr/local/lib/python2.7/dist-packages/ path and when I opened the file up again the error was gone.

So I'm now ready to write some Python+RDFLib code!

Comments

submit