How do I add python3 kernel to jupyter (IPython)

My Jupyter notebooks installed with python 2 kernel. I do not understand why. I might have messed something up when I did the install. I already have python 3 installed. How can I add it to Jupyter ? Here's a screenshot of what the default Jupyter insalled with python3 -m install jupyter and opened in the browser with jupyter notebook looks like: 在这里输入图像描述


Make sure you have ipykernel installed and use ipython kernel install to drop the kernelspec in the right location for python2. Then ipython3 kernel install for Python3. Now you should be able to chose between the 2 kernels regardless of whether you use jupyter notebook , ipython notebook or ipython3 notebook (the later two are deprecated).

Note that if you want to install for a specific Python executable you can use the following trick:

path/to/python -m ipykernel install <options>

This works when using environments (venv,conda,...) and the <options> let you name your kernel (see --help ). So you can do

conda create -n py36-test python=3.6
source activate py36-test
python -m ipykernel install --name py36-test
source deactivate

And now you get a kernel named py36-test in your dropdown menus, along the other ones.

See Using both Python 2.x and Python 3.x in IPython Notebook which has more recent information.


This worked for me on Ubuntu 16.04:

python2 -m pip install ipykernel
python2 -m ipykernel install --user

python3 -m pip install ipykernel
python3 -m ipykernel install --user

Reference to the documentation:
Kernels for Python 2 and 3. Installing the IPython kernel - IPython Docs.


  • Got ipython notebook with Python2 (on Windows7)
  • upgrade to Jupyter with pip install -U jupyter
  • install Python3
  • install Jupyter again using pip3 install jupyter
  • install Python3 kernel using ipython3 kernelspec install-self
  • I finally got 2 working kernels.
  • 很棒的结果

    链接地址: http://www.djcxy.com/p/68942.html

    上一篇: ipython在ssh终端中缓慢执行xdotool命令

    下一篇: 如何将python3内核添加到jupyter(IPython)