上一篇已安装了anaconda,在此基础上安装jupyter notebook
1、安装 ipython
pip install ipython
安装完成过后输入 ipython,如下所示,exit()退出
2、安装 jupyter
pip install jupyter
3、配置环境,通过远程方式访问 jupyter notebook
(1)
jupyter notebook --generate-config
如果出现以下提示,请在之前的命令后面加 –allow-root
jupyter notebook –generate-config –allow-root
[C 09:07:26.948 NotebookApp] Running as root is not recommended. Use –allow-root to bypass.
(2)生成登陆密码,在虚拟机环境下不建议使用密码登录,修改配置文件的时候密码建议屏蔽,如果是云主机,则生成密码
打开ipython,创建一个密文的密码:
root@iZ2zee2vax219ettpmx1jnZ:/home/dingnana/software# ipython
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:5b063c3b6c40:443b5ace516b148600bbfbce43fbc5899cd40456'
4、修改配置文件
vi /root/.jupyter/jupyter_notebook_config.py 或者
vi ~/.jupyter/jupyter_notebook_config.py
#去掉这几行的注释
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.password = u'sha1:5b063c3b6c40:443b5ace516b148600bbfbce43fbc5899cd40456'
c.NotebookApp.port = 8888
5、开通8888端口
iptables -A INPUT -p tcp --dport 8761 -j ACCEPT