conda command not found even though path is export

2020-07-10 11:34发布

I installed anaconda3 into my home directory. This is what I am seeing within the terminal:

enter image description here

and my .bash_profile looks like this:

export PATH="/Users/spotter/anaconda3/bin:$PATH"

So I don't understand why conda is not being recognized. When I navigate to anaconda3/bin there is a file called conda in there, but even when I try to call it within that pathway it is still not found.

5条回答
ら.Afraid
2楼-- · 2020-07-10 11:48

in Mac OS, for conda >4,4, the conventional way of exporting path (export PATH="Users/myuser/anaconda3/bin:$PATH") is NOT recommended anymore. First, see what is error message in your terminal in Mac when you type conda --version. If it says zsh conda not found then you are using ZSH terminal, so modifying any bash file is useless. In this case, you need to edit your .zprofile. on the other hand, if you get error like bash conda not found you edit .bash_profile. Lets, say we have zsh error, then type in terminal:

sudo nano ~./zprofile

located your conda.sh file by searching in your finder. Most probably it is in ~/anaconda3/etc/profile.d/conda.sh (for me it was like: /Users/hasbah/opt/anaconda3/etc/profile.d/conda.sh, but instead of anaconda3, it might be conda)

then you type in .zhprfile this:

. /Users/myuser/opt/anaconda3/etc/profile.d/conda.sh
conda activate base

then you save (ctrl+X and Y when was asked to save) and restart the terminal. Now if you type conda --version you will see it. so, in short:

sudo nano ~/.zproflie
. /Users/myuser/opt/anaconda3/etc/profile.d/conda.sh
conda activate base

save ./zproflie file
close terminal
open new terminal
conda --version
查看更多
Ridiculous、
3楼-- · 2020-07-10 11:54

I had to type source ~/anaconda3/bin/activate.

查看更多
Luminary・发光体
4楼-- · 2020-07-10 11:56

For anyone that landed here that is using a non-standard shell (zsh for example) the installer 5.3.1 currently changes the bash_profile not the current active default terminal.

Just open ~/.bash_profile, find the block that is added by the installer and copy it into your .zshrc file (if using zsh)

查看更多
太酷不给撩
5楼-- · 2020-07-10 12:04

Rather than adding the ~/anaconda3/bin to your PATH, you should add

. ~/anaconda3/etc/profile.d/conda.sh
conda activate base

to your .bash_profile or .bashrc, or type that in a shell, if you don't want it to be activated for each shell. This is the recommended way to activate conda since conda 4.4. See: https://github.com/conda/conda/blob/master/CHANGELOG.md#440-2017-12-20

查看更多
Root(大扎)
6楼-- · 2020-07-10 12:09

Spotter, your path to conda is incorrect.

I'm on High Sierra MAC OS and just installed Anaconda3 via HomeBrew command. I had issue with running :

 conda

It'd also give me:

-bash: conda: command not found

I tried running:

export PATH=~/anaconda3/bin:$PATH

but it needs ENTIRE path. so here are the correct steps:

$ nano ~/.bash_profile

Now export the ENTIRE path, in my case it was:

export PATH=/usr/local/anaconda3/bin:$PATH

Exit out and run:

$ source ~/.bash_profile

Then try:

$ conda

it'll output:

 $ conda --version
    conda 4.4.10
查看更多
登录 后发表回答