PYTHONPATH

bruno at modulix onurb at xiludom.gro
Thu Apr 20 09:38:39 EDT 2006


sushant.sirsikar at gmail.com wrote:
> Hi,
>   I am using Linux env.I set the PYTHONPATH using
> 
> import sys
> sys.path.append(----)

This does not sets the PYTHONPATH.

bruno at bousin ~/public_html/aquitaine-pqa $ python -h
(snip)
Other environment variables:
(snip)
PYTHONPATH   : ':'-separated list of directories prefixed to the
               default module search path.  The result is sys.path.
(snip)

That is : it's the PYTHONPATH environnement variable that is used - if
defined - to set sys.path - not the other way round

> But we i close python and start again i is not showing my new entry in
> PYTHONPATH.

Of course.

> Can anyone help me to make my path persistant?

Just like any other environnement variable on your system. With most
distros, it will be something like adding the line:

export PYTHONPATH="/a/possible/path;/another/one;/and/a/third"

either in /etc/profile (will be system-wide default) or ~/.bash_profile
(will be user-specific).

but this may vary according to your distro and your shell.


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list