zoukankan      html  css  js  c++  java
  • Jupyter notebook用法

    参考官网文档:https://jupyter-notebook.readthedocs.io/en/stable/public_server.html

    0.介绍jupyter notebook

    (此前被称为 IPython notebook)是一个交互式笔记本,支持运行 40 多种编程语言。

    Jupyter Notebook 的本质是一个 Web 应用程序,便于创建和共享文学化程序文档,支持实时代码,数学方程,可视化和 markdown。 用途包括:数据清理和转换,数值模拟,统计建模,机器学习等等。

    他的一个很大优点就是可以把代码、运行结果保存在一个notebook中,这对于学习算法比较重要,因为以后看代码的时候,可以很明确代码运行结果(尤其是在图像处理方面)。

    1.安装jupyter notebook

    检查是否有安装jupyter notebook,终端输入jupyter notebook,如果报错就是没有啦,那么就要用下面命令安装。

    $sudo pip install pyzmq
    $sudo pip install tornado
    $sudo pip install jinja2
    $sudo pip install jsonschema
    $sudo pip install jupyter

    2.生成配置文件

    $jupyter notebook --generate-config

    启动

    $jupyter notebook

    生成密钥,密码为admin

    3.修改默认配置文件

    $vim ~/.jupyter/jupyter_notebook_config.py

    进行如下修改(这里可以自行配置):

    c.NotebookApp.ip='*'
    c.NotebookApp.password = u'sha1:784e14cad32b:1d768f3613ae1a8ff7d74ca34b741591d6656767'
    c.NotebookApp.open_browser = False
    c.NotebookApp.port =8888 #随便指定一个端口
    c.IPKernelApp.pylab = 'inline'

    4.启动Jupter notebook

    $jupyter notebook

    或启动Jupter notebook并指定端口

    $jupyter notebook --no-browser --port=8889

    5.访问WEB页面

    http://localhost:9999/

    6.create a new notebook with python3新建文件

    内容:

    %matplotlib inline

    import numpy as np
    import matplotlib.pyplot as plt

    x=np.arange(9)
    y=np.sin(x)
    plt.plot(x,y)
    plt.show()

    7.安装python库

    $ pip install matplotlib

    8.笔记效果

    %matplotlib inline
    import matplotlib.pyplot as plt
    import numpy as np

    x = np.arange(20)
    y = x**2

    plt.plot(x, y)

  • 相关阅读:
    libyuv 代码结构分析,借用其NEON/ARM64优化代码
    Android 交叉编译 IPerf3
    Android Change TCP Congestion Control
    Unpack & Repack Android system.img & data.img
    Android can only be built by versions 3.81 and 3.82
    Build Android Kernel && Kernel Module
    换行符
    python之%s、%d、%f的使用
    Python+selenium 实现不定位元素,输入enter键
    进程间通信 (IPC) 方法总结(三)
  • 原文地址:https://www.cnblogs.com/amoyzhu/p/8675247.html
Copyright © 2011-2022 走看看