Created
May 19, 2020 09:55
-
-
Save jamieparkinson/404042159fc04e4d1d38b3cb7fdf56c1 to your computer and use it in GitHub Desktop.
Create a Jupyter kernel using a virtualenv
This file contains 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
#!/usr/bin/env bash | |
set -e | |
VIRTUALENVS_DIR=${WORKON_HOME:-$HOME/.virtualenvs} | |
if [ -z "$1" ]; then | |
echo "Please specify an environment name!" | |
exit -1 | |
fi | |
ENV_NAME=$1 | |
echo "Creating virtualenv '$ENV_NAME'..." | |
python3 -m venv $VIRTUALENVS_DIR/$ENV_NAME | |
source $VIRTUALENVS_DIR/$ENV_NAME/bin/activate | |
echo "Activated virtualenv." | |
echo "Installing kernel for virtualenv..." | |
pip3 install ipykernel | |
python3 -m ipykernel install --user --name=$ENV_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
jupytenv.sh env-name