Skip to content

Instantly share code, notes, and snippets.

@evu
Created September 14, 2019 15:35
Show Gist options
  • Save evu/6c909c8a851d8c8a3ccee0ca76e9ad25 to your computer and use it in GitHub Desktop.
Save evu/6c909c8a851d8c8a3ccee0ca76e9ad25 to your computer and use it in GitHub Desktop.
Add jupyter kernel for a virtualenv
#!/bin/bash
#
# Adds a jupyter kernel for a virtualenv
# This makes the virtualenv available for use in a Jupyter notebook
# Run this from the directory containing your virtualenv directory and
# pass it the directory name for your virtualenv.
#
# Usage:
# $ ./add_jupyter_kernel.sh myvenv
#
echo "Kernel name: $1"
source $1/bin/activate
echo "Using pip: $(which pip)"
pip install ipykernel
ipython kernel install --user --name="$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment