python – How to get base conda installation directory (not CONDA_PREFIX)?

I’m trying to figure out the best way to get the base conda installation directory.

I wrote this but I know this isn’t the best way to do it:

(base) -bash-4.2$ which conda
/usr/local/devel/ANNOTATION/jespinoz/anaconda3/bin/conda

(base) -bash-4.2$ which conda | python -c "import sys; print("https://stackoverflow.com/".join(sys.stdin.read().split("https://stackoverflow.com/")[:-2]))"
/usr/local/devel/ANNOTATION/jespinoz/anaconda3

Is there some environment variable I’m missing?

Read more here: Source link