• Windows7下Jupyter Notebook使用入门


    目录

    一、Jupyter简介

    二、Jupyter安装

       2.1 python 3安装

       2.2 Jupyter 安装

    三、Jupyter使用示例

    四、Jupyter常用命令

    五、其他说明

     

    一、Jupyter简介

        Jupyter Notebook是一个交互式笔记本,由IPython Notebook演化而来,本质上是一个Web应用程序,通过Jupyter Notebook,你可以使用谷歌浏览器完成python开发工作、交互式演示python代码的执行效果、进行可视化教学等。还可以将整个交互过程转换为python、html、markdown、PDF等多种格式的文件。也可以通过网络,将python代码及运行效果与朋友共享。

     

    二、Jupyter Notebook安装

        2.1 python 3的安装(略)

        2.2 Jupyter安装

           python3 -m pip install --upgrade pip  #更新

           python3 -m pip install jupyter    #安装jupyter

           jupyter notebook  #运行notebook

     

    三、Jupyter Notebook使用示例

        01-安装jupyter-notebook

        02-安装matplotlab包

        03-运行jupyter-notebook

        04-在jupyter-notebook中,画一条sin曲线

        05-直接访问本地8888端口,需要输入密码或token

        06-token的获取方式-jupyter notebook list

        07-运行Python,使用passwd,生成sha1密码

        08-修改过jupyter notebook配置文件后,重启服务

        09-正常转化为PDF需要安装Windows版本的Miktex,并且要设置好路径,安装扩展包

       

    四、Jupyter常用命令

    jupyter --help  #查看jupyter帮助

    jupyter notebook help  #查看notebook详细的命令使用帮助

    jupyter notebook #使用默认配置启动notebook

    jupyter notebook --generate-config #在c:/Users/用户/.jupyter/目录下,创建默认配置文件jupyter_notebook_config.py

    jupyter notebook list  #查看正在运行的jupyter服务器地址、token令牌、根目录

    jupyter notebook password  #修改notebook登录密码

    jupyter nbconvert file1.ipynb --to pdf  #手工转换ipynb文件为PDF文件

    jupyter nbconvert file1.ipynb --to html  #手工转换ipynb文件为html文件

     

    五、其他说明

    5.1 jupyter 除了jupyter notebook子命令以外,还有好多子命令,比如jupyter nbconvert / jupyter console 等,可用通过jupyter --help查看。

    5.2 如果直接运行jupyter notebook 命令,系统会自动创建一个48位的token,并使用默认配置启动notebook,用户可以通过http://localhost:8888/?token=<48位token >网址访问notebook,每次退出并重启notebook 服务端,系统会自动重新生成token。

    5.3 可以在运行jupyter notebook的cmd控制台中,获取token信息,当通过网络访问jupyter notebook时,输入该token,可登录jupyter notebook。

    5.4 也可以使用jupyter notebook password 命令,创建一个访问密码,创建密码以后,token方式会失效,只可以使用密码方式访问。同时会生成一个哈希密码文件,路径为C:/Users/用户/.jupyter/jupyter_notebook_config.json。重启jupyter notebook服务端,密码才生效。

    5.5直接运行jupyter notebook命令,只能在本机访问notebook。我们还可以带IP和Port参数启动notebook,例:jupyter notebook --ip=192.168.1.123 --port=6789 ,可以通过http://192.168.1.123:6789地址,在其他电脑上访问notebook。

    5.6 如果使用jupyter notebook --generate-config命令生成默认配置文件jupyter_notebook_config.py,我们也可以把IP、port等信息写入到该配置文件中,直接启动jupyter notebook时,会读取配置文件的内容。变量如下,

    c.NotebookApp.ip = '192.168.1.123'

    c.NotebookApp.port = 6789

    5.7 直接将ipynb文件转换为html和py文件是没有问题的,要转换为pdf文件会报错,需要到https://miktex.org/download,下载安装Miktex(basic-miktex-2.9.7021-x64.exe),并将C:Program FilesMiKTeX 2.9miktexinx64路径加入到系统Path路径中。可以使用命令行方式转换:jupyter nbconvert test.ipynb --to pdf ,也可以直接在notebook网站中打开test.ipynb文件,直接导出PDF文件。

     

     

    参考链接:

    Jupyter官网

    https://jupyter.org/

    https://jupyter-notebook.readthedocs.io/en/stable/

     

    Jupyter Notebook介绍与入门

    https://blog.csdn.net/ibelieveican2015/article/details/79024927

     

    jupyter-使用及设置密码

    https://www.jianshu.com/p/b1189769aeb2

     

    Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

    http://www.cnblogs.com/zlslch/p/6984403.html

     

    为什么Jupyter Notebook会比其他工具更受欢迎?

    http://m.elecfans.com/article/687743.html

     

    jupyter安装,修改登录密码,启动

    https://blog.csdn.net/hotpotbo/article/details/79130899

  • 相关阅读:
    多态的使用
    抽象类与具体类
    对象应该长什么样子
    方法的重载overload
    遵守合约:覆盖的规则
    Android 自定义Dialog
    less 之Extend 及 Extend all用法
    github常见错误整理!
    js获取元素宽高
    解决 Error: Access denied for user 'root'@'localhost' (using password: YES)
  • 原文地址:https://www.cnblogs.com/rancher-maomao/p/10607754.html
Copyright © 2020-2023  润新知