Windows10远程访问Ubuntu服务器上的Jupyter Notebook解决办法

概要:

  可能有的同学在使用Python的时候喜欢使用.py文件,而有的同学喜欢使用Jupyter Notebook做开发,但是苦于不会使用远程服务器的Jupyter Notebook而放弃,而这篇文章将教会你怎样远程访问Jupyter Notebook。

官方地址:官方地址

远访配置:

  • 创建Jupyter Notebook配置文件
$ jupyter notebook --generate-config
  • 设置Jupyter Notebook远访密码
$ jupyter notebook password
Enter password: **** Verify password: **** [NotebookPasswordApp] Wrote hashed password to /Users/you/.jupyter/jupyter_notebook_config.json
  • 准备hash密码
$ python
In [1]: from notebook.auth import passwd In [2]: passwd() Enter password: Verify password: Out[2]: 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'
  • 编辑Jupyter Notebook配置文件 jupyter_notebook_config.py
$ vi /home/username/.jupyter/jupyter_notebook_config.py

c.NotebookApp.ip = '*'
# 配置之前生成的hash密码
c.NotebookApp.password = u'sha1:bcd259ccf...<your hashed password here>'
c.NotebookApp.open_browser = False
# 配置用于远程访问的端口号
# It is a good idea to set a known, fixed port for server access
c.NotebookApp.port = 9999
  • 开启远程服务器的Jupyter Notebook服务
$ jupyter notebook

  现在我们就可以通过浏览器访问远程服务器的Jupyter Notebook: https://your.host.com:9999 (your.host.com是你的远程服务器的IP地址)。注意:我们也可以用启动Jupyter Notebook服务时服务器指定的端口对Jupyter Notebook进行访问。

猜你喜欢

转载自www.cnblogs.com/dyc99/p/12755179.html