Finding dynamic libraries

Robert Kern robert.kern at
Fri Sep 15 17:24:19 CEST 2006

Bill Spotz wrote:
> Hi,
> Is there a way to tell an executing python script where to look for  
> dynamically-loaded libraries?
> My situation is that that I am developing python wrappers for a large  
> software project.  I create python wrappers with swig, and those  
> extension modules link against dynamic libraries from the project.  I  
> have many test scripts that I would like to be able to run *prior* to  
> installing these libraries into a standard location.
> I have tried altering the LD_LIBRARY_PATH and DYLD_LIBRARY_PATH  
> environment variables, both by direct assignment of os.environ and by  
> calling os.putenv(), but neither results in python being able to find  
> my dynamic libraries.

Those environment variables need to be set before the python executable starts.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

More information about the Python-list mailing list