Q: How to install my own library on linux ?

Johannes Nix jnix at rioverde.cafeconleche.de
Wed Dec 6 12:05:44 EST 2000


hwan-jo yu <hwanjoyu at students.uiuc.edu> writes:

> Hi,
> 
> When we do "import something", it checks the files in sys.path list.
> I would like to add my own library path in the sys.path list, but I don't
> want to do sys.path.append() every source.
> Is there any way to modify data of the original sys.path of python2.0 on
> linux, so a source doesn't have to do sys.path append() to import my
> library file ?


For the simple cases it should be sufficient to set the PYTHONPATH
environment variable. For example you could do

export PYTHONPATH=/usr/local/lib/python/site-packages:$HOME/lib/python

in your .profile file.

Of course this can be made processor-specific as well. Clearly, this
does not work if you have conflicting names for modules.


Johannes Nix




More information about the Python-list mailing list