Using virtualenv in Jupyter Notebook

5/9/2018 pythoncodetutorial
  • OS: macOS High Sierra 10.13.4
  • Default Python version: 3.6.5

# Prerequisites

  1. Have your Jupyter Notebook and virtualenv installed with your default python version
  2. Have one virtual env created which you want to use

# Walkthrough

# Activate your virtualenv

source <envpath>/bin/activate
1

# Install ipykernel inside your env

$(yourenv)> pip install ipykernel
1

# Create kernel using your env

$(yourenv)> python -m ipykernel install --user --name myenv --display-name "Python (myenv)"
1

# Go ahead and enjoy

Now open your jupyter notebook and you'll notice your kernel just created appears along with your default kernel. Enjoy it😀

Last Updated: 5/6/2021, 9:08:41 AM