Ok. So, I'm used to Ubuntu and CentOS more than redhat, so I'm hoping there's some obvious solution to this that I'm missing.
I've installed Anaconda (Python). I've placed it in:
/opt/anaconda3
I would like for myself and all users to be able to have the following in their paths:
/opt/anaconda3/bin
I have googled around and have gained a lot of conflicting information about how to "properly" accomplish my mission.
Stuff I have tried:
- Adding a bash script to /etc/profile.d
- Editing /etc/profile
- Editing /etc/bashrc
- Adding to root bashrc
- Editing user .bashrc
All edits involved some form of:
PATH=/opt/anaconda3/bin:$PATH
or
export PATH=/opt/anaconda3/bin:$PATH
Option 2 yielded the addition of /opt/anaconda3/bin to the path for multiple users, but after terminal restarts still did not run the commands within bin (i.e. conda install, ipython notebook, etc.)
Any ideas?
Best Answer
Create a file named (say) anaconda.sh in /etc/profile.d/ with the contents:
The trailing ".sh" is important, as that is the syntax that /etc/profile uses to search for files to include. Bash will read /etc/profile at login. If you want a current shell/terminal to pick up the change, just run
. /etc/profile.d/anaconda.sh
.If you encounter situations where a non-interactive shell needs it, you're left with ~/.bashrc (unless the calling environment uses --rcfile to override that behavior).