How do I add python3 kernel to jupyter (IPython)

2019-01-03 00:30发布

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 notebooklooks like: enter image description here

18条回答
冷血范
2楼-- · 2019-01-03 01:11
  1. Got ipython notebook with Python2 (on Windows7)
  2. upgrade to Jupyter with pip install -U jupyter
  3. install Python3
  4. install Jupyter again using pip3 install jupyter
  5. install Python3 kernel using ipython3 kernelspec install-self
  6. I finally got 2 working kernels.

great results

查看更多
迷人小祖宗
3楼-- · 2019-01-03 01:11

None of the other answers were working for me immediately on ElementaryOS Freya (based on Ubuntu 14.04); I was getting the

[TerminalIPythonApp] WARNING | File not found: 'kernelspec'

error that quickbug described under Matt's answer. I had to first do:

sudo apt-get install pip3, then

sudo pip3 install ipython[all]

At that point you can then run the commands that Matt suggested; namely: ipython kernelspec install-self and ipython3 kernelspec install-self

Now when I launch ipython notebook and then open a notebook, I am able to select the Python 3 kernel from the Kernel menu.

查看更多
倾城 Initia
4楼-- · 2019-01-03 01:13
sudo apt-get install python3-pip python3-dev
pip3 install -U jupyter
查看更多
家丑人穷心不美
5楼-- · 2019-01-03 01:13

I am pretty sure all you have to do is run

pip3 install jupyter

查看更多
【Aperson】
6楼-- · 2019-01-03 01:18

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.

查看更多
霸刀☆藐视天下
7楼-- · 2019-01-03 01:18

I successfully installed python3 kernel on macOS El Capitan (ipython version: 4.1.0) with following commands.

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

You can see all installed kernels with jupyter kernelspec list.

More info is available here

查看更多
登录 后发表回答