Utiliser virtualenv dans un notebook iPython

Source : https://help.pythonanywhere.com/pages/IPythonNotebookVirtualenvs/

Install the ipython kernel module into your virtualenv

python3 -m venv plop cd plop source bin/activate pip install --upgrade pip pip install ipykernel #deactivate

Now run the kernel “self-install” script

python -m ipykernel install --user --name=plop

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.