Skip to content

Instantly share code, notes, and snippets.

@zouzias
Last active August 14, 2017 09:18
Show Gist options
  • Save zouzias/befd4994807e269ff3cd1ca446eb4da2 to your computer and use it in GitHub Desktop.
Save zouzias/befd4994807e269ff3cd1ca446eb4da2 to your computer and use it in GitHub Desktop.
How to setup virtualenv and Jupyter Notebooks
1. Install kernelspec for python3
Make sure it is not there
jupyter kernelspec list
jupyter kernelspec install /usr/local/Cellar/python3/3.6.1/bin/
jupyter kernelspec list
2. Using a virtualenv in an IPython notebook
You can use a virtualenv for your IPython notebook. Follow the following steps:
Install the ipython kernel module into your virtualenv
workon my-virtualenv-name # activate your virtualenv, if you haven't already
pip install ipykernel
Now run the kernel "self-install" script:
python -m ipykernel install --user --name=my-virtualenv-name
Replacing the --name parameter as appropriate.
You should now be able to see your kernel in the IPython notebook menu: Kernel -> Change kernel and be able so switch to it (you may need to refresh the page before it appears in the list). IPython will remember which kernel to use for that notebook from then on.
https://help.pythonanywhere.com/pages/IPythonNotebookVirtualenvs/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment