首页 > 其他 > 详细

远程访问虚拟机 jupyter notebook

时间:2019-09-04 12:22:07      阅读:165      评论:0      收藏:0      [点我收藏+]

在服务器上配置jupyter, 方便我们远程登录.

第一步:安装jupyter, pip3 install jupyter (此处使用的是python3)

第二步:生成配置文件jupyter notebook --generate-config

gz@ubuntu:~$ cd .jupyter/
gz@ubuntu:~/.jupyter$ ll
total 12
drwxr-xr-x  2 gz gz 4096 Sep  3 14:56 ./
drwxr-xr-x 36 gz gz 4096 Sep  4 11:28 ../
-rw-r--r--  1 gz gz   26 Sep  3 14:56 migrated
gz@ubuntu:~/.jupyter$ jupyter notebook --generate-config
jupyter: command not found
gz@ubuntu:~/.jupyter$ workon py3_face
(py3_face) gz@ubuntu:~/.jupyter$ jupyter notebook --generate-config
Writing default config to: /home/gz/.jupyter/jupyter_notebook_config.py
(py3_face) gz@ubuntu:~/.jupyter$ ll
total 48
drwxr-xr-x  2 gz gz  4096 Sep  4 11:35 ./
drwxr-xr-x 36 gz gz  4096 Sep  4 11:28 ../
-rw-rw-r--  1 gz gz 33341 Sep  4 11:35 jupyter_notebook_config.py
-rw-r--r--  1 gz gz    26 Sep  3 14:56 migrated
(py3_face) gz@ubuntu:~/.jupyter$ 

第三步:生成密钥 打开python3

>>> from notebook.auth import passwd
>>> passwd()
Enter password: 
Verify password: 
'sha1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
>>> 

修改配置文件

vim + ~/.jupyter/jupyter_notebook_config.py

添加内容如下:

c.NotebookApp.ip="192.168.xxx.xxx"
c.NotebookApp.password = u"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"   # 刚才复制的那个密文
c.NotebookApp.open_brower = False # # 禁止自动打开浏览器
c.NotebookApp.port = 8888 #随便指定一个端口

这里注意:c.NotebookApp.ip=‘104.222.1.1‘,这里应该填写你服务器的ip,网上的全部都是c.NotebookApp.ip=‘*‘,我照着测试后踩了很多坑。

物理机打开浏览器
输入
http://192.168.xxx.xxx:8888/

输入前面设置的密码。

远程访问虚拟机 jupyter notebook

原文:https://www.cnblogs.com/linusgau/p/11458183.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!