14

Whenever I open a terminal, I have to write

export PATH=~/anaconda3/bin:$PATH

to use any feature of anaconda

I want a persistent path.

2
  • 1
    I'm voting to leave this question open despite the similarities because this problem is so common to Anaconda that it deserves a separate question for Anaconda users.
    – karel
    Jul 31 '18 at 3:49
  • Also I don't think it would be a good idea to merge the two questions because that would require deleting Klaus-Dieter Warzecha's answer.
    – karel
    Jul 31 '18 at 6:46
19

the file .bashrc (hidden file), located in the home directory, runs codes every time a new terminal is opened.

Then add a line on it:

export PATH=~/anaconda3/bin:$PATH
2
  • I'm running Mint and I have this line in my .bashrc. But I note that .bashrc is not run when I start an env console from within anaconda navigator. I added that line to /etc/bash.bashrc and it worked (single user system)
    – PhilW
    Sep 30 '18 at 17:06
  • 1
    it worked on my ubuntu 18.04 LTS, thanks @Vitor Nov 9 '18 at 14:43
5

Wouldn't it be nice if somebody else would handle that for you? ;-)

Edit your .profile and add something like the following lines:

if [ -d "$HOME/anaconda3/bin" ] ; then
    PATH="$HOME/anaconda3/bin:$PATH"
fi
2
  • 1
    What does the if statement with the -d indicate here?
    – Rik
    Sep 14 '16 at 15:26
  • @Rik Square brackets with -d are used to test if the string is a directory. Sep 14 '16 at 21:34
2

Start with:

sudo nano ~/.bashrc

go down to the last line in the file and add

export PATH=~/anaconda3/bin:$PATH

then Ctrl+X and then enter

open a new terminal and enjoy anaconda--navigator

1
  • this worked on ubuntu 20.04 LTS and Anaconda3
    – Shadab K
    Apr 30 '20 at 9:57
0

Reinstall anaconda, and notice that at the end of the install process there is a optional selection that allow you to add conda command to your PATH.

You can choose to say yes, and then you can use the command conda.

Not the answer you're looking for? Browse other questions tagged or ask your own question.