在 jupyter 中选择 python 内核 [英] choose python kernel in jupyter

查看:52
本文介绍了在 jupyter 中选择 python 内核的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在 Debian Jessie 上安装了:

Python2.7

Python3.5

我还通过 pip2pip3

安装了 Jupyter

但是,当我启动 jupyter-notebook 时,我只能使用 python3 作为内核!使用 Jupyter 时如何切换到 pyhton2.7?

解决方案

我在 Digital Ocean 上用一台全新的 Debian 8.5 机器试了一下.

以 root 身份从 apt 安装 pipjupyter 以及开发包.

apt-get install python-pip python-dev python3-pip python3-dev libzmq3pip3 安装 jupyter

使用 ipykernel 模块为 Python2 添加内核.Python3 内核已经安装好了.

pip install ipykernelpython2 -m ipykernel 安装

当您运行 jupyter notebook 时,您应该将 Python 2Python 3 列为可用内核.请注意,Tornado 笔记本服务器在端口 8888 上提供 HTTP 服务,默认情况下在许多机器上未打开该端口.这是

I have installed on Debian Jessie:

Python2.7

Python3.5

I have also installed Jupyter via pip2 and pip3

However when I launch jupyter-notebook I can only use python3 as kernel! How can I switch to pyhton2.7 when using Jupyter?

解决方案

I tried this with a fresh Debian 8.5 machine on Digital Ocean.

As root, install pip and jupyter from apt, and the development packages, too.

apt-get install python-pip python-dev python3-pip python3-dev libzmq3
pip3 install jupyter

Add the kernel for Python2 using the ipykernel module. The Python3 kernel is installed, already.

pip install ipykernel
python2 -m ipykernel install

When you run jupyter notebook, you should have both Python 2 and Python 3 listed as available kernels. Notice that the Tornado notebook server is serving HTTP on port 8888, which isn't opened by default on many machines. Here is a script that will run Jupyter for you, opening and closing port 8888 and running on a public IP.

这篇关于在 jupyter 中选择 python 内核的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆