又是美好的一天 開開心心寫代碼
1. 安裝ipython, jupyter
pip install ipython pip install jupyter
2. 生成配置文件
[root@50eb5057baac /]# jupyter notebook --generate-config
Writing default config to: /root/.jupyter/jupyter_notebook_config.py
3. 生成密碼
root@50eb5057baac /]# ipython
Type 'copyright', 'credits' or 'license' for more information IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:43b95b731276:5d330ee6f6054613b3ab4cc59c5048ff7c70f549'
In [3]: 到此 exit登出,繼續往下運行
4. 修改默認配置文件
執行命令:vim /root/.jupyter/jupyter_notebook_config.py
修改以下內容並去掉前面的注釋 #:
c.NotebookApp.ip='*' #設置訪問notebook的ip,*表示所有IP,這里設置ip為都可訪問
c.NotebookApp.password=u'sha1:5df252f58b7f:bf65d53125bb36c085162b3780377f66d73972d1' #填寫剛剛生成的密文
c.NotebookApp.open_browser = False # 禁止notebook啟動時自動打開瀏覽器
c.NotebookApp.port =8889 #指定訪問的端口,默認是8888。
5. 啟動jupyter notebook --no-browser
直接起動會報不建議以root身份運行.使用--allow-root繞過過.所以我們要執行以下命令:
jupyter notebook --allow-root
6. 然后你就可以在瀏覽器里敲入你的地址 http://yourip:8889/, 看到界面就是安裝成功了