Jupyter Notebook
Jupyter Notebook可以在网页页面中直接编写代码和运行代码,代码的运行结果也会直接在代码块下显示。如在编程过程中需要编写说明文档,可在同一个页面中直接编写,便于作及时的说明和解释。
安装
pip install jupyter或pip3 install jupyter
配置修改
#生成配置文件jupyter notebook --generate-configWriting 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:fc62874a0050:c956d438fd4980d130cb078708e2c34a41c1a879' ## 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 passwdpasswd()# 此时需要输入两次密码(一次设置,一次确认),然后生成sha1的密文,拷贝下来。# Enter password: ········# Verify password: ········# sha1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
![07374eb4614d46d9f174b0e2024beb73.png](https://i-blog.csdnimg.cn/blog_migrate/392d2d9a7357d8126b90fae01b5b82d0.jpeg)
生成一个sha1的密钥
安装扩展
pip install jupyter_contrib_nbextensions 或pip3 install jupyter_contrib_nbextensionsjupyter contrib nbextension install --user
启动jupyter notebook
#Windowsjupyter notebook#Linuxjupyter notebook --allow-root
打开网页
远程
http://172.168.1.217:8888/
本机
http://127.0.0.1:8888/
![29b5198c9cd25a1c41e575395e0a9838.png](https://i-blog.csdnimg.cn/blog_migrate/93562cda6a9463051fe227f6e99f216f.jpeg)
输入配置文件sha1对应的明文密码进行登录
![16afa49ccb275c79ce69b3a06021163b.png](https://i-blog.csdnimg.cn/blog_migrate/73d8accecdae460e8a5f51aded9a8ab3.jpeg)
jupyter界面