1、安装anaconda https://www.anaconda.com/download/#linux 建议在内核3.10上的机器上进行安装
2、配置jupyter
2.1、初始化配置文件 jupyter notebook --generate-config --allow-root Writing default config to: /root/.jupyter/jupyter_notebook_config.py
2.2、生成密码 [root@jupyter ~]# ipython
Python 2.7.5 (default, Nov 6 2016, 00:28:07)
Type "copyright", "credits" or "license" for more information.
IPython 5.3.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:da874cad4309:4104089e5ef97c8fcbe69c2ac7d6a1071ca50a40'
2.3、配置修改,根据关键词修改即可 62 #c.NotebookApp.allow_root = False
去掉62行的注释,并修改成True即可解决root权限运行的问题。
163 #c.NotebookApp.ip = 'localhost'
去掉注释,并把localhost改成0.0.0.0,这样就可以外部访问了,默认只有在本机可以访问的;
163 c.NotebookApp.ip = '0.0.0.0'
203 #c.NotebookApp.notebook_dir = u''
改成如下,这样就会默认把notebook上创建的文件保存到指定目录下;需要事先创建。
203 c.NotebookApp.notebook_dir = u'/opt/jupyter'
218 #c.NotebookApp.password = u''
加入上面创建的密码:
218 c.NotebookApp.password = u'sha1:da874cad4309:4104089e5ef97c8fcbe69c2ac7d6a1071ca50a40'
3、运行 https://jupyter.readthedocs.io/en/latest/running.html jupyter notebook notebook.ipynb jupyter notebook --port 9999 jupyter notebook --no-browser