jupyter use virtualenv kernel code example
Example 1: jupyter from virtualenv
$ python -m venv projectname
$ source projectname/bin/activate
(venv) $ pip install ipykernel
(venv) $ ipython kernel install --user --name=projectname
Example 2: change kernel from a jupyter cell
%%javascript
Jupyter.notebook.session.restart({kernel_name: 'python3'})