1、下载jupyter
pip install ipython
pip install jupyter
如果安装时出现了如下的错误:
You are using pip version 18.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
那就执行pip install --upgrade pip
即可
2、配置
输入jupyter命令
如果出现途中的结果则继续进行配置,如果出现-bash: jupyter: command not found
,则执行以下操作:
find -name jupyter
vim /etc/profile
export PATH=$PATH:/usr/local/python3/bin/ #添加此行代码至最后一行
source /etc/profile
jupyter
出现步骤2中第一张图的结果则证明可以继续进行配置jupyter了
jupyter notebook --generate-config \--allow-root
执行成功后会出现:
Writing default config to: /root/.jupyter/jupyter_notebook_config.py
3、生成密码
从 jupyter notebook 5.0 版本开始,提供了一个命令来设置密码:jupyter notebook password
,生成的密码存储在 jupyter_notebook_config.json。
jupyter notebook password
进入ipython
ipython
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:fa826555782f:b77fca515f6c7b28e0d7aa27e5a0e182dace7a96'
vim /root/.jupyter/jupyter_notebook_config.py #此路径为步骤二最后的输出结果路径
在 jupyter_notebook_config.py 中找到下面的行,取消注释并修改
c.NotebookApp.ip='0.0.0.0'
c.NotebookApp.password = 'sha1:fa826555782f:b77fca515f6c7b28e0d7aa27e5a0e182dace7a96'
c.NotebookApp.open_browser = False
c.NotebookApp.port =8888 #访问时使用该端口
c.NotebookApp.notebook_dir = '' #服务器存放文件的路径地址
保存后就可以对我们的jupyter启动了。
jupyter notebook # root 用户需要添加 --allow-root
jupyter notebook --generate-config --allow-root遇到的问题
错误信息很明显,没有sqlite3,楼主开始安装,
yum install sqlite* #此处用*纯粹是为了方便
安装时又出现了为了,是因为楼主前边把系统的python版本进行了一次升级,修改了/usr/bin/yum文件中的第一行,/usr/libexec/urlgrabber-ext-down文件中的第一行需要和yum中的一样,所以需要将/usr/libexec/urlgrabber-ext-down中的第一行python的版本也进行修改和yum中一致,然后再次安装,成功!