Python shared library - "libpython" naming convention

Viewed 323

We are adding support to call python functions from our application. The user inputs the python module path and the python version they want to execute the module in. Valid version strings are any valid python versions of the form 2.7.* and 3.6.*.

We dynamically load the python interpreter shared library based on the input version string, for e.g. "2.7" loads libpython2.7.so and call methods in the library to run the module.

The problem is that there seems to be no consistent naming pattern for the interpreter library.

  • libpython2.7.so => libpython2.7.so.1.0 symbolic link is not created on some machines
  • libpythonx.x has an 'm' (for malloc) appended on a few machines.
  • two or more installations of python 2.7 (of different subversions) can be done side by side on a machine, but the libraries do not seem to have a version attached to them

Is there a way to convert a python version string to a python interpreter library name on Linux?

0 Answers
Related