Python, Linux, default search places.

Wildman best_lay at yahoo.com
Thu Apr 7 14:26:21 EDT 2016


On Thu, 07 Apr 2016 13:02:46 +0200, Frantisek.Fridrich wrote:

> Hello.
> 
> I run a third party program that can use a system installation of Python. 
> I have to modify environment variables: 
> PYTHONPATH,
> PATH,
> LD_LIBRARY_PATH.
> 
> All these environment variables are empty at the beginning but Python uses 
> a default or initial places to search for modules, libraries or 
> executables.
> 
> Q1. Could anybody tell me where I could find default search places for 
> environment variables PYTHONPATH, PATH, LD_LIBRARY_PATH?
> 
> OS: SUSE Linux Enterprise Server 11. 
> HW: HP DL160 Gen8 SFF CTO.
> Python 2.6.
> 
> Frantisek

You should be able to retrieve any environment variable
like this, if it exists:

    import os
    env_var = os.environ["PATH"]

Environment variables use the colon, ':', to separate
entries so you can do this if you want a list:

    env_var_list = os.environ["PATH"].split(":")
 
BTW, variable names are case sensitive in Linux.  The
ones set by the system are normally all upper case.
That is not absolute in cases where variables are set
by 3rd party programs.

-- 
<Wildman> GNU/Linux user #557453
Why is it all instruments seeking intelligent life
in the universe are pointed away from Earth?
  -unknown



More information about the Python-list mailing list