zoukankan      html  css  js  c++  java
  • IPython和IPython Notebook的安装和简单应用

    https://zhuanlan.zhihu.com/p/25428460

    IPython是一个python shell的扩展,强调了IPython可交互性和探索性计算 。

    官网(http://IPython.org/)上的介绍如下

    The goal of IPython is to create a comprehensive environment for interactive and exploratory computing. To support this goal, IPython has three main components:

    An enhanced interactive Python shell.

    A decoupled two-process communication model, which allows for multiple clients to connect to a computation kernel, most notably the web-based notebook

    An architecture for interactive parallel computing.

    里面3个组件:

    IPython shell、IPython Notebook、交互是并行计算的架构

    其中IPython Notebook目前已经成为用Python做教学、计算、科研的一个重要工具,很多示例都是用.ipynb文件。

    这次主要介绍在Python已经安装的前提下,IPython和IPython Notebook的安装和简单使用。

    当然也可以直接安装 Anaconda等这些发型包,不用自己一个个安装了。

    安装参考文档

    --IPython

    http://IPython.org/install.html

    --IPython Notebook

    Installing Jupyter Notebook

    具体操作都是在pyenv 351环境下使用,注意进入和退出环境的比例:

    pyenv activate env351

    pyenv deactivate

    0.系统准备工作

    系统默认没有装g++,如果需要使用IPython Notebook,那就装

    sudo apt-get install g++

    1.安装IPython及IPython Notebook

    pip install IPython

    pip install urllib3 --安装IPython Notebook的依赖

    pip install jupyter --安装IPython Notebook

    2.安装科学计算包

    sudo apt-get install libfreetype6-dev

    sudo apt-get install gfortran

    sudo apt-get install libopenblas-dev liblapack-dev

    sudo apt-get apt-get install libpng12-0 libpng12-dev

    pip install numpy

    pip install matplotlib

    pip install pandas

    pip install scipy

    pip install scikit-learn

    --numpy

    3.使用IPython

    ipython --进入IPython交互环境

    提示符不一样,看一下示例

    如果不知道具体函数可以使用tab键提示

    import datetime

    datetime. --按tab键

    查询功能?

    datetime.

    一些%开始的魔术命令

    %magic 查看帮助

    运行python脚本

    %run aa.py

    %run -i aa.py --继承变量

    4.使用IPython notebook

    jupyter notebook --启动服务

    在浏览器里面可以看到IPython notebook的交互环境

    每个cell可以放一组命令, 按shift + enter可以执行

    注意显示图形需要%matplotlib inline



    同时open file可以打开.ipynb文件,.ipynb文件保存演示真的很好用

    _________________________________________________________________________________________________________________________________________________
    每一个不曾起舞的日子,都是对生命的辜负。
    But it is the same with man as with the tree. The more he seeks to rise into the height and light, the more vigorously do his roots struggle earthward, downward, into the dark, the deep - into evil.
    其实人跟树是一样的,越是向往高处的阳光,它的根就越要伸向黑暗的地底。----尼采
  • 相关阅读:
    apache2.4+php7.3.2+mysql5.7
    redis 中的key值过期后,触发通知事件
    zookeeper之分布式锁以及分布式计数器(通过curator框架实现)
    SpringCloud学习笔记(4)——Zuul
    SpringCloud学习笔记(3)——Hystrix
    SpringCloud学习笔记(2)——Ribbon
    c++各种排序的简单实现
    c++动态规划dp算法题
    华为机试练习
    ubuntu遇到的 the system is runing low-graphics mode 问题
  • 原文地址:https://www.cnblogs.com/leoking01/p/14607409.html
Copyright © 2011-2022 走看看