问题
I installed anaconda3 into my home directory. This is what I am seeing within the terminal:
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.
回答1:
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
回答2:
I had to type source ~/anaconda3/bin/activate
.
回答3:
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)
回答4:
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
回答5:
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
来源:https://stackoverflow.com/questions/49821930/conda-command-not-found-even-though-path-is-exported