美文网首页
jupyter配置和远程访问

jupyter配置和远程访问

作者: 骆旺达 | 来源:发表于2019-10-01 13:53 被阅读0次

jupyter

1、文件格式

.ipynb

2、window安装

pip install jupyter
安装好之后,从系统命令行
比如Windows下的cmd,切换到文件目录下
在命令行下执行
jupyter notebook

2.1 如果想打开某个ipynb格式文件

jupyter notebook notebook.ipynb

2.2 快捷键

1、Shift+K  / Shift + Up(上按钮):上移
2、Shift+J  / Shift + Down(下按钮):下移
3、Shift-Enter : 运行本单元,选中下个单元
4、Ctrl-Enter : 运行本单元
5、Alt-Enter : 运行本单元,在其下插入新单元

2.3 代码自动补全

首先安装 nbextensions

pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user

然后安装 nbextensions_configurator

pip install jupyter_nbextensions_configurator
jupyter nbextensions_configurator enable --user
image.png image.png

3、Linux服务器安装并远程访问

3.1 inux服务器安装anaconda:

2.1.1 下载安装脚本:
wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh   
**下载3.5的amaconda,适应ubuntu版本(或者去官网下载)**

2.1.2 运行安装向导:
bash Anaconda3-5.2.0-Linux-x86_64.sh

2.1.3 确认是否安装成功:
conda --version

3.2 生成配置文件

$jupyter notebook --generate-config

3.3 生成密码

打开ipython,(在ipython环境下)创建一个密文的密码:
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:ce23d945972f:34769685a7ccd3d08c84a18c63968a41f1140274'

把生成的密文‘sha:ce…’复制下来

3.4 修改默认配置文件

$vim ~/.jupyter/jupyter_notebook_config.py 
进行如下修改:
c.NotebookApp.ip='*'
c.NotebookApp.password = u'sha:ce...刚才复制的那个密文'
c.NotebookApp.open_browser = False
c.NotebookApp.port =8888 #随便指定一个端口

3.5 启动jupyter

jupyter notebook

3.6 远程访问

此时应该可以直接从本地浏览器直接访问http://ip:8888就可以看到jupyter的登陆界面。

参考:https://www.cnblogs.com/wwwhza/p/8821117.html[图片上传失败...(image-62c228-1569909161327)]

相关文章

网友评论

      本文标题:jupyter配置和远程访问

      本文链接:https://www.haomeiwen.com/subject/hkukpctx.html