iPython与notebook的基本用法


 

1 Ipython 安装

      pip install ipython

2 Notebooke 基本用法

     启动ipython使用ipython

     启动notebook 使用 ipython notebook

3 远程使用Ipython notebook 的配置方法

     3.0 创建远程服务

                 语法:  ipython profile create <你要创建的服务器名>

                 e.g.:

                         ipython profile create myserver

              此时终端会输出 生成的文件位置, 请记住这个位置

     3.1 配置openssl 认证

                   openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem

此时会输出生成的sha 的值, 请记住输出

               为了方便今后的使用: 此时可以将 mycert.pem 证书移到 ipython notebook的文件夹,将相关的东西放在一起。

       mv mycert.pem .ipython

     3.2  修改配置文件

c = get_config()

# Kernel config
c.IPKernelApp.pylab = 'inline'  # if you want plotting support always

# Notebook config
c.NotebookApp.certfile = u'/home/XXX/.ipython/mycert.pem' ##认证的位置
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.password = u'sha1:XXXX' ## 认证输出的sha值
# It's a good idea to put it on a known, fixed port
c.NotebookApp.port = 9999
 
 
 

      3.3 重新启动ubuntu, 并且启动ipython notebook 服务器

       ipython notebook --profile=nbserver

      3.4 远程连接Ipython NoteBook

      打开本地浏览器访问远程noteBook 地址就行,记住端口号是9999

 

 

 

 

 
原文地址:https://www.cnblogs.com/greentomlee/p/6498403.html