I have downloaded and installed python 2.6.5. now I can find Python. h:
[qing1981] /home/qing/software/Python-2.6.5 > ls /usr/local/include/python2.6/Python.h
/usr/local/include/python2.6/Python.h
but i can not find libpythonx.y.so in /usr/loca/lib/
[qing1981] /home/qing/software/Python-2.6.5 > ls /usr/local/lib/
libpython2.6.a python2.6/
if you install python from source, supply --enable-shared to configure to enable the shared library. That said, in theory linking to the archive library should work.
[pcncu17] /scratch/qing/software/root > ls /scratch/qing/software/Python-2.7.1/Include/Python.h
/scratch/qing/software/Python-2.7.1/Include/Python.h
[pcncu17] /scratch/qing/software/root > ls /scratch/qing/software/Python-2.7.1/libpython2.7.so
/scratch/qing/software/Python-2.7.1/libpython2.7.so
Then I downlaoded root and ‘
./configure --with-python-incdir=/scratch/qing/software/Python-2.7.1/Include/Python.h --with-python-libdir=/scratch/qing/software/Python-2.7.1/libpython2.7.so > tmp’
[pcncu17] /scratch/qing/software/root > cat tmp | grep Python
Checking for Python.h … no
Checking for python2.4, libpython2.4, libpython, python, or Python … no
Seems ROOT still could not find python.h and the python lib, any idea?
[pcncu17] /scratch/qing/software/root > …/Python-2.7.1/python
…/Python-2.7.1/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
the --with-python-incdir/libdir parameters take the directories, not the actual .h and .so. For running python from a different location, PATH and LD_LIBRARY_PATH need to be set to point to the executable and the shared library, respectively. Finally, not that after “gmake”, you’ll still need to run “gmake install” which installs python and all its modules in the directory specified with --prefix to ./configure (or in /usr/local by default).
I installed ROOT with config:
./configure linux --enable-python --with-python-incdir=/usr/include/python2.6/Python.h --with-python-libdir=/usr/lib/libpython2.6.so
I use Ubuntu and this is my standard python.
In config.log:
Checking for python, libpython, libpython, python, or Python …
libraries to check for: python.sopython.sl python.dylib python.dll.a libpython.solibpython.sl libpython.dylib libpython.dll.a libpython.solibpython.sl libpython.dylib libpython.dll.a python.sopython.sl python.dylib python.dll.a Python.soPython.sl Python.dylib Python.dll.a python.a python.lib python libpython.a libpython.lib libpython libpython.a libpython.lib libpython python.a python.lib python Python.a Python.lib Python
Checking in directories /usr/lib/libpython2.6.so for python.sopython.sl python.dylib python.dll.a libpython.solibpython.sl libpython.dylib libpython.dll.a libpython.solibpython.sl libpython.dylib libpython.dll.a python.sopython.sl python.dylib python.dll.a Python.soPython.sl Python.dylib Python.dll.a python.a python.lib python libpython.a libpython.lib libpython libpython.a libpython.lib libpython python.a python.lib python Python.a Python.lib Python
library not found !!!
after that i installed python 2.7 with:
./configure --enable-shared
after that config root like:
./configure linux --with-python-incdir=/usr/local/include/python2.7 --with-python-libdir=/usr/local/lib/python2.7
And can’t find again:
Checking for library python.so in directory /usr/local/lib/python2.7
Checking /usr/local/lib/python2.7/python.so python.so not found in /usr/local/lib/python2.7
Checking for library python.sl in directory /usr/local/lib/python2.7
Checking /usr/local/lib/python2.7/python.sl python.sl not found in /usr/local/lib/python2.7
Checking for library python.dylib in directory /usr/local/lib/python2.7
Checking /usr/local/lib/python2.7/python.dylib
python.dylib not found in /usr/local/lib/python2.7
Checking for library python.dll.a in directory /usr/local/lib/python2.7
Checking /usr/local/lib/python2.7/python.dll.a
python.dll.a not found in /usr/local/lib/python2.7
etc…
for the first (p2.6): --with-python-inc/libdir should point to the dirs, not the files. For the second (p2.7): the standard location is /usr/local/lib not /usr/local/lib/python2.7. Note that if python is installed in a standard location and the version that you want is available through PATH, the standard locations will be found automatically.
I have done make with that config.
And i have now: /usr/local/lib/root/libPyROOT.so and /usr/local/lib/root/ROOT.py
But :
augre@lilian:~$ root
/usr/local/bin/root.exe: error while loading shared libraries: libCore.so: cannot open shared object file: No such file or directory
And I set
augre@lilian:~$ echo $PYTHONPATH
/usr/local/lib:
But when I try python 2.6 and ROOT 5.32, the following error appeared:
python: error while loading shared libraries: libpython2.6.so.1.0: cannot open shared object file: No such file or directory
most common reason for this error is easily fixed. just do
sudo apt-get install python-dev
this way you can use the build-in python in your linux (works in Ubuntu tested should be fine in most other distribs)