How to tell a Python program where a shared library is?

Steven D. Majewski sdm7g at Virginia.EDU
Thu May 3 13:30:44 EDT 2001


On Thu, 3 May 2001, Edward C. Jones wrote:

> Suppose I have a shared library, say "mymodule.so". How do I tell a Python
> program where "mymodule.so" is? If necessary I can change the PATH environment
> variable. How is this done?

The python variable sys.path contains the module search path as a list
of pathnames. You can append or insert new paths into that list. 

The list contains all of the usual places that python looks (constructed
from a list of relative paths and the location of the executable -- 
at least that's how the unix version works. ) 

If you assign to the environment variable PYTHONPATH before running
python, those paths, as well as the null path ('') will be prepended
onto the sys.path list. 

-- Steve Majewski






More information about the Python-list mailing list