本文共 1131 字,大约阅读时间需要 3 分钟。
anaconda一般自带安装好了juypter ,如果没有,可以用conda install jupyter
命令安装。
安装好以后,需要在服务器上配置jupyter以便任何浏览器都能通过IP直接访问服务器上的juypter服务。
通过命令jupyter notebook --generate-config
生成配置文件。
/home/.jupyter/jupyter_notebook_config.py
在命令行输入python
,然后执行下面的两条语句并根据提示输入密码
from notebook.auth import passwdpasswd()
确认密码后会生成一个sha1码,这个码需要记住。
Enter password: Verify password: 'sha1:*************’
因为Jupyter必须要用https进行登录,所以需要生成ssl证书。
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mykey.key -out mycert.pem
上面的命令可以自动生成证书,但是这个证书是不安全的,只能在测试过程中使用。
在~/.jupyter/jupyter_notebook_config.py
末尾添加如下内容
c.NotebookApp.password = u'sha1:***' #上面第二步中生成的密钥c.NotebookApp.certfile = u'/absolute/path/to/your/certificate/mycert.pem'c.NotebookApp.keyfile = u'/absolute/path/to/your/certificate/mykey.key’c.NotebookApp.ip = '*'c.NotebookApp.open_browser = False# It is a good idea to set a known, fixed port for server accessc.NotebookApp.port = 9999
先在服务器上想要执行ipynb的目录下用jupyter notebook
命令启动服务,然后
Reference:
转载地址:http://qftqb.baihongyu.com/