The C libraries have a nice form of late binding, where the exact version of the library that was used during linking is recorded, and thus an executable can find the correct file, even when several versions of the same library are installed.
Can the same be done in Python?
To be more specific, I work on a Python project that uses some 3rd-party libraries, such as paramiko. Paramiko is now version 1.7.4, but some distributions carry an older version of it, while supplying about the same version of the Python interpreter.
Naturally, I would like to support as many configurations as possible, and not just the latest distros. But if I upgrade the installed version of paramiko from what an old distro provides, I 1) make life hard for the package manager 2) might break some existing apps due to incompatibilities in the library version and 3) might get broken if the package manager decides to overwrite my custom installation.
Is it possible to resolve this problem cleanly in Python? (i.e., how would i do the setup, and what should the code look like). Ideally, it would just install several versions of a library in site_libraries and let my script select the right one, rather than maintaining a private directory with a set of manually installed libraries..
P.S.: I could compile the Python program to a binary, carrying all the necessary dependencies with it, but it kind of works against the idea of using the interpreter provided by the distro. I do it on Windows though.