[X-Unix] Set PYTHONPATH

Xavier Noria fxn at hashref.com
Wed Apr 21 01:01:24 PDT 2004


On Apr 21, 2004, at 9:46, Simon Forster wrote:

> So, how do I set python's path for my user? And, FWIW, if I "echo 
> $PYTHONPATH" in the Terminal, I get a blank line. My research suggests 
> that this is a valid environment variable though. Don't understand.

These kind of variables (PYTHONPATH, PERL5LIB, CLASSPATH, ...) are 
normally unset unless someone initializes them.

If your shell is bash, put in ~/.bashrc the line

     export PYTHONPATH=/Users/simonforster/Development/Python/Lib

in zsh that goes in ~/.zshenv. Other shells use other rc files.

Once you've done that there's no need in general to modify sys.path 
from the very script.

-- fxn

PS: You'll need to source the rc file or open a new Terminal.app to 
make the initialization effective.



More information about the X-Unix mailing list