Getting Started with PyRoot

Hi there, I am attempting to learn how to use PyRoot as an interface to Root. I am very new to Root and have never coded in C++ before so PyRoot seemed logical. I am currently trying to get PyRoot to work.
From the terminal I am running the following:

herbie@herbie-laptop:~$ export LD_LIBRARY_PATH=$ROOTSYS/lib:$PYTHONDIR/lib:$LD_LIBRARY_PATH
herbie@herbie-laptop:~$ export PYTHONPATH=$ROOTSYS/lib:$PYTHONPATH
herbie@herbie-laptop:~$ python
Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
[GCC 4.4.1] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

import ROOT
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named ROOT

import numpy
import pylab
from ROOT import gROOT, TCanvas, TF1
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named ROOT

As you can see, Python is not finding the ROOT module. I don’t understand why this is.
Any help would be greatly appreciated.
G.Herbert

Ok so I found the solution:

I needed to install “libroot-python-dev” from the package manager,

and then because I’m using Ubuntu 9.10 I also needed to use the statement:
import sys; sys.path.append(’/usr/lib/root/’)
before then using
import ROOT

Hi,

instead of appending to sys.path, adding that path to the PYTHONPATH envar should have the same effect.

Cheers,
Wim