Skip to content

Instantly share code, notes, and snippets.

@iiey
Created February 25, 2022 09:44
Show Gist options
  • Save iiey/fb93df3f4d8409c8838bdcc21976708c to your computer and use it in GitHub Desktop.
Save iiey/fb93df3f4d8409c8838bdcc21976708c to your computer and use it in GitHub Desktop.
start notebook inside conda env (here named: jupyter)
#!/usr/bin/env bash
# conda is not in PATH manually specify installed directory
CONDADIR="$HOME/miniconda3"
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('$CONDADIR/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "$CONDADIR/etc/profile.d/conda.sh" ]; then
. "$CONDADIR/etc/profile.d/conda.sh"
else
export PATH="$CONDADIR/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
# enter env, start notebook and exit env after complete
conda activate jupyter
jupyter "${@}"
conda deactivate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment