How to force the path of a lib ?

Vincent Vande Vyvre vincent.vande.vyvre at telenet.be
Thu Jan 24 05:24:39 EST 2019


Le 23/01/19 à 13:11, Neal Becker a écrit :
> dieter wrote:
>
>> Vincent Vande Vyvre <vincent.vande.vyvre at telenet.be> writes:
>> .....


>> To load external C/C++ shared objects, the dynamic lickage loader
>> (ldd) is used. "ldd" does not look at Pthon's "sys.path".
>> Unless configured differently, it looks at standard places
>> (such as "/usr/lib/x86_64-linux-gnu").
>>
>> You have several options to tell "ldd" where to look for
>> shared objects:
>>
>>   * use the envvar "LD_LIBRARY_PATH"
>>     This is a "path variable" similar to the shell's "PATH",
>>     telling the dynamic loader in which directories (before
>>     the standard ones) to look for shared objects
>>
>>   * use special linker options (when you link your Python
>>     extension shared object) to tell where dependent shared
>>     object can be found.
>>
> To follow up on that last point, look up --rpath and related.
>
Trying the first solution with "export 
LD_LIBRARY_PATH=/home/vincent/CPython/py370_venv/lib" has no effect.

The second solution is better, after looking de doc of 
distutils.core.Extension I've added this line into my setup.py
     Extension('libexiv2python',
         ...,
runtime_library_dirs=['/home/vincent/CPython/py370_venv/lib/'],
         ...

rebuild, install and test
Type "help", "copyright", "credits" or "license" for more information.
 >>> import pyexiv2
 >>>

Great!

Many thanks,
Vincent




More information about the Python-list mailing list