一、安装命令
pip3 install jupyter
二、创建配置文件
jupyter notebook --generate-config
[root@fangangmysql217 /root/.pip]# jupyter notebook --generate-config
Writing default config to: /root/.jupyter/jupyter_notebook_config.py
三、修改配置
vim /root/.jupyter/jupyter_notebook_config.py
远程访问与密码设置以及目录设置 需要修改的内容
## notebook服务会监听的IP地址.
c.NotebookApp.ip = '*'
## Hashed password to use for web authentication.
#
# To generate, type in a python/IPython shell:
#
# from notebook.auth import passwd; passwd()
#
# The string should be of the form type:salt:hashed-password.
c.NotebookApp.password = u'sha1:dd9287a1a0ab:071ba1257bfcbb7c4ec63e6872a98081c6d2c201'
## The port the notebook server will listen on (env: JUPYTER_PORT).
c.NotebookApp.port = 8888
## 用于笔记本和内核的目录。
c.NotebookApp.notebook_dir = '/root/樊纲/jupyter_code'
## Whether to open in a browser after starting. The specific browser used is
# platform dependent and determined by the python standard library `webbrowser`
# module, unless it is overridden using the --browser (NotebookApp.browser)
# configuration option.
c.NotebookApp.open_browser = False
生成一个sha1的密钥
from notebook.auth import passwd
passwd()
# 此时需要输入两次密码(一次设置,一次确认),然后生成sha1的密文,拷贝下来。
# Enter password: ········
# Verify password: ········
# sha1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
四、启动jupyter
jupyter notebook --allow-root
[root@fangangmysql217 /root/.pip]# jupyter notebook
[I 09:19:46.551 NotebookApp] 把notebook 服务cookie密码写入 /root/.local/share/jupyter/runtime/notebook_cookie_secret
[W 09:19:47.005 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[C 09:19:47.007 NotebookApp] 不建议以root身份运行.使用--allow-root绕过过.
[root@fangangmysql217 /root/.pip]# jupyter notebook --allow-root
五、打开jupyter
jupyter主机IP+端口8888
http://172.168.1.217:8888/login
输入配置时设置的密码