SUSE Linux global PATH and PYTHONPATH
I’m expanding on a tweet here, which has attracted a number of visitors who probably didn’t find it very useful.
Here’s the original text of the tweet:
On SUSE Linux, set global PATH and PYTHONPATH bash environment variables in /etc/bash.bashrc.local - how is it on other distros?
At work, we are a “Novell house”. Our Linux servers run SLES, but I would expect these configurations to work with OpenSUSE.
So the idea here is to set a global PATH & PYTHONPATH for all users, such that all users can run command line tools that depend on custom Python modules or other libraries.
If we take a look in the
/etc folder, there’s already a
bash.bashrc, which contains global shell settings. A quick read of this says we should put user-level shell settings in a separate file, namely
/etc/bash.bashrc.local when the shell starts, if it exists.
Let’s create this file. You’ll need sudo permissions for this. I’m using
vim here because the other SUSE editor
joe is unspeakably bad and
creates~ silly~ backups~ everywhere~:
sudo vim /etc/bash.bashrc.local
Add your desired PATH variables, in insert mode
[i]. Below are some examples:
export PYTHONPATH=.:/path/to/python/libs/:$PYTHONPATH export PATH=.:/opt/local/bin:$PATH
Save and exit vim
Log back in to your shell and test it.
echo $PYTHONPATH .:/path/to/python/libs/: echo $PATH .:/opt/local/bin: