PYTHONPATH

Edward Elliott nobody at 127.0.0.1
Sun Apr 23 17:28:51 EDT 2006


Brian van den Broek wrote:
> The suggestions above appear not to work for me:
> 
> brian at Cedric:~$ cat /etc/profile | grep 'export PYTHONPATH'
> export PYTHONPATH="~/PythonFiles"
> brian at Cedric:~$ cat .bash_profile | grep 'export PYTHONPATH'
> export PYTHONPATH="~/PythonFiles"

Those files are only read when you start the shell.  I'm guessing you made 
those changes from the currently running shell.  To fix it you have 3 choices:
1. Close the shell and start a new one
2. Type 'bash -l' at the prompt to invoke a new login shell
3. Type '. .bash_profile' to read the changes into your current shell

> (I don't think it should matter, but I also tried the export line with 
> "/home/brian" in place of "~" in both files.

Nope doesn't matter, as long as 'echo $HOME' is /home/brian.

> I don't know where to look for more information; I'm assuming that 
> ubuntu isn't doing it the standard way bruno referred to above. Could 
> some ubuntu user cast light, please?

This information bruno gave is correct.  It's not an ubuntu issue, it's the 
way unix shells are designed to work.  It's generally udnerstood that 
changing environment variables in a profile requires forcing the shell to 
reprocess them in one of the ways above.  You can also type 'export 
"VAR=value"' to set a variable in the current bash shell (but it's value 
will be lost when the shell exits).

You might want to google for "bash shell tutorial" and familiarize yourself 
with how bash shells work.  It can be somewhat confusing at first, but it's 
a very powerful way to interact with your system.



More information about the Python-list mailing list