Activate a Conda Install Manually

I create a lot of independent Miniconda installs that I want to activate manually. Back in the day, you could just do this by putting $PREFIX/bin in $PATH, but things are different now. Namely:

eval "$(@PREFIX@/bin/conda shell.bash hook)"

with the super important note that the double quotes are essential!

For reference, here’s the shell script snippet that Conda wants to put in your .bashrc, as of Miniconda 4.6.14, with @PREFIX@ substituted as appropriate:

__conda_setup="$('@PREFIX@/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "@PREFIX@/etc/profile.d/conda.sh" ]; then
        . "@PREFIX@/etc/profile.d/conda.sh"
    else
        export PATH="@PREFIX@/bin:$PATH"
    fi
fi
unset __conda_setup

(Apparently this comes from conda init somehow.)

Questions or comments? For better or worse this website isn’t interactive, so send me an email or, uh, Toot me.

To get notified of new posts, try subscribing to my lightweight newsletter or my RSS/Atom feed. No thirsty influencering — you get alerts about what I’m writing; I get warm fuzzies from knowing that someone’s reading!

See a list of all how-to guides.

On GitHub you can propose a revision to this guide or view its revision history.