Ghrua
Ghrua

Reputation: 7656

I have to type export PATH=~/anaconda/bin:"$PATH" everytime I rerun the terminal

I have installed the Anaconda for Mac, but there is something wrong with me:

when I type the commandwhich conda or which ipython, I get conda not found and ipython not find

Then I find this command export PATH=~/anaconda/bin:"$PATH" works for me. It solves the problem above, but everytime I rerun the terminal the problem is still there, I have to type it again.

so I want to find a way to solve the problem fundamentally

I have tried to add it into the ~/.bashrc, ~/.profile, ~/.bash_profile, but these don't work for me.

Upvotes: 16

Views: 70916

Answers (6)

spbl69
spbl69

Reputation: 11

conda path fix

Best fix is to set your conda base to auto activate.

If you entered "no", when it asked whether you want to automatically initialize conda whenever you need to use it, it will not update your $SHELL variable by adding:

export PATH="/opt/anaconda3/bin:$PATH"

in /home/user/.bashrc

Then do :

source ~/.bashrc

check whether the path is exported by

echo $PATH

after this do :

conda init

For Permanent fix :

The base environment is activated by default

conda config --set auto_activate_base True

The base environment is not activated by default

conda config --set auto_activate_base False

The above commands only work if conda init has been run first

I hope it will solve your problem.

Upvotes: 1

Jalome Chirwa
Jalome Chirwa

Reputation: 39

If you're using ZShell follow the steps below:

  1. In your terminal type open ~/.zshrc
  2. Add the following to the file export PATH=/opt/homebrew/bin:$PATH
  3. Save your file and then run the following command source ~/.zshrc

Please note that the homebrew path on Apple silicon is /opt/homebrew/bin

Upvotes: 0

Axblert
Axblert

Reputation: 576

I run on MacOs Catalina 10.15 and this did the trick for me: shell is zsh !

$ source /Users/myprofilename/anaconda3/bin/activate

then

$ conda init zsh

the new anaconda documentation also highlights this:

Upvotes: 9

kasra
kasra

Reputation: 31

Make sure you're not using ZShell or another form of a shell. If the case you'd have to add the path to your respective shell file, e.g .zshrc.

Upvotes: 3

GB.Domingos
GB.Domingos

Reputation: 21

sudo xed /etc/environment

after open this archive add :/home/youruser/anaconda3/bin

Upvotes: 2

Zv_oDD
Zv_oDD

Reputation: 1878

Try this in .bash_profile

export PATH="$HOME/anaconda/bin:$PATH"

Then try launching a new terminal and running:

echo $PATH

The output should start with /anaconda/bin:

If that still doesn't work... A work around might be to invoke bash after running terminal i.e. type "bash". Which should cause bash to launch with .bash_profile

Upvotes: 21

Related Questions