I am attempting to install the Python3 bindings for ROOT, but always seem to end up with Python2 bindings. I have used the CMake flags -Dpython=ON and -Dpython3=ON. I have both python2 and python3 installed and the python command defaults to the python 2 version. From a posting by @Graipher I have a suspicion that it has to do with what the default python version is (he has the opposite issue). Do I need to change where the default points before configuring to get the correct version?
The error message recieved when trying to start in python3 is:
$ python3.6
Python 3.6.2 (default, Sep 21 2017, 00:54:38)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/root/6.10.06-py3/lib/ROOT.py", line 24, in <module>
import cppyy
File "/opt/root/6.10.06-py3/lib/cppyy.py", line 61, in <module>
import libPyROOT as _backend
ImportError: dynamic module does not define module export function (PyInit_libPyROOT)
I went ahead and tested this changing python to point to python3, rebuilt and I get the python3 bindings. Using this information and the info from @Graipher it seems the the -Dpython3 flag is ignored and the version is picked from what the alias python points to.