2

Is there a python command to change the kernel during an evaluation of a jupyter notebook's cell, something like:

In[1:] #on utilise le kernel python3
       change_kernel('python3');

In[2:] #on utilise le kernel SageMath
       change_kernel('SageMath');

In[3:] #on utilise le kernel Python2
       change_kernel('Python2.7');

1 Answer 1

3

If you put this on a cell

Notebook should restart with the new kernel.

%%javascript
Jupyter.notebook.session.restart({kernel_name: 'python3'})

You can take a look at the javascript interface session

1
  • 1
    This does not work unfortunately in JupyterLab environment with Javascript Error: Jupyter is not defined error. Sep 14, 2021 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.