[Tutor] setting path
Kirby Urner
urnerk@qwest.net
Sat, 20 Apr 2002 23:12:48 -0400
What you *can* do in the shell is go:
>>> import sys
>>> sys.path.append('/home/paul/python_lib')
and you'll be able to import modules from that directory
*for this session only*. That's not what you're after,
I realize, but sometimes useful to know.
> since $PYTHONPATH is not set up.
>
If you want to set up PYTHONPATH, consider adding something
like this to your .bash_profile or .bashrc
PYTHONPATH=/home/paul/python_lib
export PYTHONPATH
After making this change, going
bash --login
at the $ prompt should reinitialize your environment without
necessitating logging out and back in again. As a check,
now try
echo $PYTHONPATH
Inside Python, the sys.path should remain the same (i.e. won't
show the addition), but now you should be able to import modules
from ~/python_lib as well.
Kirby