Enable PyROOT Ubuntu 14.04

天大地大妈咪最大 提交于 2019-12-06 15:44:57

问题


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?


回答1:


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.



回答2:


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



来源:https://stackoverflow.com/questions/29979179/enable-pyroot-ubuntu-14-04

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!