Enable PyROOT Ubuntu 14.04

2019-04-17 02:27发布

I downloaded madpgraph5, but when I run it I get the following error:

 ERROR: ROOT file called 'ROOT.py' or 'ROOT.pyc' is not found
 ERROR: Please check that ROOT is properly installed.

When I try locate ROOT.py and locate ROOT.pyc, I get nothing.

I have root 5.34 installed and it runs smoothly. I also have python 2.7.6 installed.

I downloaded rootpy, but have no idea how to include and enable PyROOT. I searched and I think I have to edit something to do with the path in bashrc, but before I do it I need to be sure of what I am doing.

Can anyone help?

2条回答
Lonely孤独者°
2楼-- · 2019-04-17 02:42

You have probably figured out how to use it already, so just in case someone else stumbles over this question.

First make sure you built ROOT with Python support, root-config --features should list python.

There are a few possibilities how to successfully use import ROOT in Python:

  1. Add export PYTHONPATH=$PYTHONPATH:$ROOTSYS/lib to your .bashrc where $ROOTSYS is the path to your ROOT installation.
  2. The first way is the easiest, but in case you want to do something like sudo pip install rootpy, your local $PYTHONPATH isn't used. Another way is to copy the files ROOT.py and libPyROOT.so from path_to_root_installation/lib to /usr/lib/pythonX (replace X with your Python version).
  3. Similar to the method above. But in case you recompile ROOT or change something else, a symbolic link might be better: sudo ln -s /path_to_root/lib/ROOT.py /usr/lib/pythonX/ROOT.py and for libPyROOT.so as well.
查看更多
孤傲高冷的网名
3楼-- · 2019-04-17 03:05

You should install libroot-bindings-python-dev -- it solves the issue.

查看更多
登录 后发表回答