user6599829
user6599829

Reputation:

Change kernel in a jupyter's cell using a python command

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');

Upvotes: 2

Views: 2655

Answers (1)

jgoday
jgoday

Reputation: 2836

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

Upvotes: 2

Related Questions