Jupyter Notebook 安装

可以通过apt-get install安装Jupyter Notebook吗?例如,我们可以使用apt-get install python-numpy来安装numpy。
6个回答

Ubuntu 22.04及更高版本

sudo apt install epiphany jupyter-notebook

创建 jupyter_notebook_config.py 的方法如下:
jupyter notebook --generate-config # type y for yes at the prompt

然后在文本编辑器中打开~/.jupyter/jupyter_notebook_config.py进行编辑,并更改:
# c.NotebookApp.browser = ''

给:
c.NotebookApp.browser = '/usr/bin/epiphany'

不要忘记删除行首的#,这样它就不再是注释了。如果你不喜欢Web浏览器,可以使用其他浏览器,只要它不是一个快照包,并且将路径从/usr/bin/epiphany更改为你的浏览器路径,你可以通过运行形如which my-web-browser的命令找到。
然而,这样还不够,你还需要进行一步操作。将~/.local/share/jupyter目录的所有权从root更改为user。在下面的命令中,将user替换为你自己登录时使用的用户名。
sudo chown -R user:user ~/.local/share/jupyter 

Ubuntu 20.04

打开终端并输入:

sudo apt install jupyter-notebook jupyter # jupyter 是可选的

Ubuntu 18.04-19.10

打开终端并输入:

sudo apt install python3-notebook jupyter jupyter-core python-ipykernel 

运行以下命令以启动笔记本服务器:
jupyter notebook

你应该能在你的网络浏览器中看到Jupyter Notebook打开。

Ubuntu 17.04和17.10

在Ubuntu 17.04及更高版本中,Jupyter Notebook可以在默认的Ubuntu软件源中找到,并且可以通过apt快速简便地安装。打开终端并输入以下命令:

sudo apt install jupyter-notebook jupyter-core python-ipykernel 

在Jupyter Notebook中运行Python 2.x程序需要python-ipykernel,否则只支持Python 3.x。

要启动笔记本服务器,请运行以下命令:

jupyter notebook

你应该在你的网页浏览器中看到Jupyter Notebook打开。
Ubuntu 16.04及更早版本
Google Colaboratory是谷歌免费的Jupyter笔记本环境,无需设置,完全在云端运行。

1我遇到以下错误:$jupyter notebook 执行Jupyter命令'notebook'时出错:[Errno 2] 没有该文件或目录 - Boba Fit
使用命令jupyter-troubleshoot可以帮助您解决这个问题。 - karel
1我移除了很多Python包并重新安装它们。现在它可以正常工作了,但我不知道为什么。不过对我来说没关系。谢谢你。 - Boba Fit
1你还需要执行apt-get install jupyter-notebook,就像这里建议的一样:https://stackoverflow.com/questions/42648610/error-when-executing-jupyter-notebook-no-such-file-or-directory - Felix
1Ubuntu 20.04用户可以使用上述18.04命令,但不应包括python-ipykernel。 - mike
1看起来在20.04版本中,只需要运行apt-get install jupyter-notebook命令即可。 - dmvianna

我使用它安装了

pip install jupyter

(如果安装了Python3,请使用pip3;同时确保您具有root访问权限,即作为root@...登录到终端)

以及Python依赖项

apt-get install build-essential python3-dev

在Ubuntu桌面14.04.3 LTS上,我正在使用Python3。

Jupyter在Ubuntu软件仓库中没有包含吗? - karfai
@EdwardSiew。我不这么认为。我正在参加其中一次培训课程...他们也提到只能按照这种方式安装。 - Ashu
如果我们没有根访问权限,怎么办? - AVINASH ANAND
1@AVINASHANAND 一年后可能没用了,但也许可以试试这个方法:点击这里,使用pip install --user pkg_name命令安装软件包。 - Hendy
@AVINASHANAND 你应该可以使用sudo来做同样的事情。 - Ashu

sudo -H pip3 install jupyter(使用pip3,而不是pip)在我尝试了许多其他方法之后终于成功了。我在搭载Python 3.5.3的Ubuntu Linux上进行了这个操作,这台电脑是Lenovo Chromebook C330。我还安装了Spyder和一些常用命令,比如"locate"。


这个答案是对这个已有答案的复制:https://askubuntu.com/questions/737094/jupyter-notebook-installation/1005871#1005871 - karel

根据官方建议这里,我们应该使用:
python -m pip install jupyter
python3 -m pip install jupyter

在执行这个命令以及之前的所有命令时,我遇到了权限错误的问题。为了解决这个问题,我们应该使用下一个命令:
python -m pip install jupyter --user
python3 -m pip install jupyter --user

似乎只使用apt-get是不可能的。
apt-file find jupyter ## returns no results

对于16.04版本:
sudo apt-get install python-pip
pip install --upgrade pip ## secret sauce -- pip fails otherwise
sudo pip install jupyter

那么

jupyter notebook

将使用Python3时的'pip'替换为'pip3'。

使用以下方式进行安装
sudo -H pip install jupyter

安装完成后,请使用以下命令。
jupyter notebook