How to install libSBML in Fedora 18 with Python bindings

Install compiler
yum install gcc-c++
yum groupinstall "Development Tools"

Install some additional packages if needed
yum install python-devel
yum install libxml2-devel
yum install swig

Compile and install libSBML
Go to the directory where you have exctracted libsbml source and run these 3 commands
./configure --with-python
make
make install

Make libsbml accessible to Python
export PYTHONPATH=/usr/local/lib64/python2.7/site-packages/libsbml
Or fix the path right from your python script
import sys
sys.path.append('/usr/local/lib64/python2.7/site-packages/libsbml')

You can get and set environment variables via os.environ:
import os
os.environ['PYTHONPATH'] = '/usr/local/lib/python2.7/dist-packages/libsbml'

But since your interpreter already runs, this will have no effect.

For whatever reason, in Fedora the library file is _libsbml, not libsml. To use libsbml in Fedora import it like this:
import _libsbml

Published by

MartinsM

Martins M.