Created
June 22, 2023 13:18
-
-
Save AdamGagorik/ac5f8883af32159bd7fb104a4e82eb8b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [[ ! -d ./.venv ]]; then | |
echo "no virtual environment in current directory" | |
exit 1 | |
fi | |
. .venv/bin/activate | |
PYVER=`python --version | cut -d " " -f2` | |
DNAME="[${PYVER}]: ${PWD}" | |
KNAME=${PWD##*/} | |
echo "DISPLAY NAME: ${DNAME}" | |
echo "KERNEL NAME: ${KNAME}" | |
echo | |
jupyter kernelspec list | |
echo | |
jupyter kernelspec uninstall ${KNAME} || true | |
echo | |
read -p "Create kernel: ${KNAME}? [y/N]: " -n 2 -r choice | |
case "$choice" in | |
y|Y) | |
echo | |
python -m ipykernel install --user --display-name "${DNAME}" --name "${KNAME}" | |
echo | |
jupyter kernelspec list | |
;; | |
*) echo "skipping..." | |
;; | |
esac | |
echo | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment