ps:我一直在用为知做笔记,我就在想如果有一个web界面的vim+跨平台+即时运行结果的编辑器[还要什么女朋友啊~j_0063.gif]

  jupyter笔记本是一个Web应用程序,允许你创建和共享代码,方程,可视化和说明性文本文档。用途包括:数据清洗和转换,数值模拟,统计建模,机器学习等。

一、安装jupyter

 1、本机环境 [看一下效果,哈哈~] wKioL1ZG87HCdSbZAAByLYKT8RI390.png

2、安装过程

  注:我刚开始安装的时候,怕被坑了,找了N多文档,结果都就在安装过程中出现各种问题,有解决依赖,无法保存的,无法补全的,不能用别名的。。。我以为这样就可以搞了,but 我竟然成功了,安装过程在一片祥和的氛围下最络达成。

  提示:安装前安装开发包组Development tools,升级系统python版本,官方要求python2.6或3.2,但是jupyter 要Python 2.7 or >= 3.3,ipython当然是最新版本的,剩下的就是安装了,一条命令搞定

yum instal -y python-pip #如果没有pip的话
#pip install virtualenv -y
[root@localhost python_object]# virtualenv --no-site-package ipython_notebook
New python executable in ipython_notebook/bin/python
Installing setuptools, pip, wheel...done.
[root@localhost python_object]# ls
Exect_number.py  firstfork.py  ipython_notebook  Prodicer.py    virtual_DJ
[root@localhost python_object]# source ipython_notebook/bin/activate
(ipython_notebook)[root@localhost python_object]# 
(ipython_notebook)[root@localhost python_object]# pip install jupyter
Collecting jupyter
/workspace/python_object/ipython_notebook/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading jupyter-1.0.0-py2.py3-none-any.whl
Collecting notebook (from jupyter)
  Downloading notebook-4.0.6-py2.py3-none-any.whl (5.6MB)
    100% |████████████████████████████████| 5.6MB 57kB/s 
Collecting ipywidgets (from jupyter)
  Downloading ipywidgets-4.1.1-py2.py3-none-any.whl (117kB)
    100% |████████████████████████████████| 118kB 1.2MB/s 
Collecting nbconvert (from jupyter)
  Downloading nbconvert-4.1.0-py2.py3-none-any.whl (281kB)
    100% |████████████████████████████████| 282kB 735kB/s 
Collecting ipykernel (from jupyter)
  Downloading ipykernel-4.1.1-py2.py3-none-any.whl (90kB)
    100% |████████████████████████████████| 94kB 1.5MB/s 
Collecting jupyter-console (from jupyter)
  Downloading jupyter_console-4.0.3-py2.py3-none-any.whl
Collecting qtconsole (from jupyter)
  Downloading qtconsole-4.1.0-py2.py3-none-any.whl (98kB)
    100% |████████████████████████████████| 102kB 1.5MB/s 
Collecting traitlets (from notebook->jupyter)
  Using cached traitlets-4.0.0-py2.py3-none-any.whl
Collecting tornado>=4 (from notebook->jupyter)
  Downloading tornado-4.3.tar.gz (450kB)
    100% |████████████████████████████████| 454kB 313kB/s 
Collecting jupyter-client (from notebook->jupyter)
  Downloading jupyter_client-4.1.1-py2.py3-none-any.whl (70kB)
    100% |████████████████████████████████| 73kB 1.7MB/s 
Collecting nbformat (from notebook->jupyter)
  Downloading nbformat-4.0.1-py2.py3-none-any.whl (138kB)
    100% |████████████████████████████████| 139kB 1.3MB/s 
Collecting jupyter-core (from notebook->jupyter)
  Downloading jupyter_core-4.0.6-py2.py3-none-any.whl (74kB)
    100% |████████████████████████████████| 77kB 1.4MB/s 
Collecting jinja2 (from notebook->jupyter)
  Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB)
    100% |████████████████████████████████| 266kB 222kB/s 
Collecting terminado>=0.3.3 (from notebook->jupyter)
  Downloading terminado-0.5.tar.gz
Collecting ipython-genutils (from notebook->jupyter)
  Using cached ipython_genutils-0.1.0-py2.py3-none-any.whl
Collecting ipython>=4.0.0dev0 (from ipywidgets->jupyter)
  Using cached ipython-4.0.0-py2-none-any.whl
Collecting pygments (from nbconvert->jupyter)
  Downloading Pygments-2.0.2-py2-none-any.whl (672kB)
    100% |████████████████████████████████| 675kB 434kB/s 
Collecting mistune!=0.6 (from nbconvert->jupyter)
  Downloading mistune-0.7.1-py2.py3-none-any.whl
Collecting decorator (from traitlets->notebook->jupyter)
  Downloading decorator-4.0.4-py2.py3-none-any.whl
Collecting backports.ssl-match-hostname (from tornado>=4->notebook->jupyter)
  Downloading backports.ssl_match_hostname-3.4.0.2.tar.gz
Collecting singledispatch (from tornado>=4->notebook->jupyter)
  Downloading singledispatch-3.4.0.3-py2.py3-none-any.whl
Collecting certifi (from tornado>=4->notebook->jupyter)
  Downloading certifi-2015.9.6.2-py2.py3-none-any.whl (371kB)
    100% |████████████████████████████████| 372kB 797kB/s 
Collecting backports-abc>=0.4 (from tornado>=4->notebook->jupyter)
  Downloading backports_abc-0.4-py2.py3-none-any.whl
Collecting pyzmq>=13 (from jupyter-client->notebook->jupyter)
  Downloading pyzmq-15.0.0.tar.gz (1.1MB)
    100% |████████████████████████████████| 1.1MB 310kB/s 
Collecting jsonschema!=2.5.0,>=2.0 (from nbformat->notebook->jupyter)
  Downloading jsonschema-2.5.1-py2.py3-none-any.whl
Collecting MarkupSafe (from jinja2->notebook->jupyter)
  Downloading MarkupSafe-0.23.tar.gz
Collecting ptyprocess (from terminado>=0.3.3->notebook->jupyter)
  Using cached ptyprocess-0.5.tar.gz
Collecting simplegeneric>0.8 (from ipython>=4.0.0dev0->ipywidgets->jupyter)
  Using cached simplegeneric-0.8.1.zip
Collecting pexpect (from ipython>=4.0.0dev0->ipywidgets->jupyter)
  Using cached pexpect-4.0.1.tar.gz
Collecting pickleshare (from ipython>=4.0.0dev0->ipywidgets->jupyter)
  Using cached pickleshare-0.5.tar.gz
Collecting six (from singledispatch->tornado>=4->notebook->jupyter)
  Using cached six-1.10.0-py2.py3-none-any.whl
Collecting functools32 (from jsonschema!=2.5.0,>=2.0->nbformat->notebook->jupyter)
  Downloading functools32-3.2.3-2.tar.gz
Collecting path.py (from pickleshare->ipython>=4.0.0dev0->ipywidgets->jupyter)
  Using cached path.py-8.1.2-py2.py3-none-any.whl
Building wheels for collected packages: tornado, terminado, backports.ssl-match-hostname, pyzmq, MarkupSafe, ptyprocess, simplegeneric, pexpect, pickleshare, functools32
  Running setup.py bdist_wheel for tornado
  Stored in directory: /root/.cache/pip/wheels/2d/e6/19/1a61a89abb78cc3e1761a5844eaa1fdc86fd41b38353df5967
  Running setup.py bdist_wheel for terminado
  Stored in directory: /root/.cache/pip/wheels/f9/7c/62/fe686f920ed9fbc013e631a5415ec3162602b31e762595e3fe
  Running setup.py bdist_wheel for backports.ssl-match-hostname
  Stored in directory: /root/.cache/pip/wheels/81/3d/36/f3c726a42caed585046d710e0e450bda1075c61c1c43443831
  Running setup.py bdist_wheel for pyzmq
  Stored in directory: /root/.cache/pip/wheels/3a/7a/27/93f017cb86670a08e6114a95c05885bb4dda1f81830ff4306c
  Running setup.py bdist_wheel for MarkupSafe
  Stored in directory: /root/.cache/pip/wheels/94/a7/79/f79a998b64c1281cb99fa9bbd33cfc9b8b5775f438218d17a7
  Running setup.py bdist_wheel for ptyprocess
  Stored in directory: /root/.cache/pip/wheels/8f/0b/d5/45ebc79539db587c173a63b42572328136bdb098210767fb80
  Running setup.py bdist_wheel for simplegeneric
  Stored in directory: /root/.cache/pip/wheels/51/3c/13/2b621669f3ba74b01380aefcc0af0f643bb42360e7248496ed
  Running setup.py bdist_wheel for pexpect
  Stored in directory: /root/.cache/pip/wheels/ea/5b/53/4b65a279e1390ae81febe74f660ce01ef4655c9c1ec9acd9bf
  Running setup.py bdist_wheel for pickleshare
  Stored in directory: /root/.cache/pip/wheels/99/3e/8b/7d87bf47f2c2d437fcb9a913cd5c4b393b7132c508633e3eef
  Running setup.py bdist_wheel for functools32
  Stored in directory: /root/.cache/pip/wheels/38/c6/c7/ee17acd621120c302e25c2fa8b3a8b235d5d1137c6ab4c9728
Successfully built tornado terminado backports.ssl-match-hostname pyzmq MarkupSafe ptyprocess simplegeneric pexpect pickleshare functools32
Installing collected packages: decorator, ipython-genutils, traitlets, backports.ssl-match-hostname, six, singledispatch, certifi, backports-abc, tornado, jupyter-core, pyzmq, jupyter-client, functools32, jsonschema, nbformat, MarkupSafe, jinja2, simplegeneric, ptyprocess, pexpect, path.py, pickleshare, ipython, ipykernel, terminado, pygments, mistune, nbconvert, notebook, ipywidgets, jupyter-console, qtconsole, jupyter
Successfully installed MarkupSafe-0.23 backports-abc-0.4 backports.ssl-match-hostname-3.4.0.2 certifi-2015.9.6.2 decorator-4.0.4 functools32-3.2.3.post2 ipykernel-4.1.1 ipython-4.0.0 ipython-genutils-0.1.0 ipywidgets-4.1.1 jinja2-2.8 jsonschema-2.5.1 jupyter-1.0.0 jupyter-client-4.1.1 jupyter-console-4.0.3 jupyter-core-4.0.6 mistune-0.7.1 nbconvert-4.1.0 nbformat-4.0.1 notebook-4.0.6 path.py-8.1.2 pexpect-4.0.1 pickleshare-0.5 ptyprocess-0.5 pygments-2.0.2 pyzmq-15.0.0 qtconsole-4.1.0 simplegeneric-0.8.1 singledispatch-3.4.0.3 six-1.10.0 terminado-0.5 tornado-4.3 traitlets-4.0.0

到此jupyter己经安装完成了,看到这么多的依赖,我对那些一步步排错手并安装成功,只能说我不如他们!

二、jupyter的使用

 1、jupyter 帮助

(ipython_notebook)[root@localhost python_object]# jupyter -h
usage: jupyter [-h] [--version] [--config-dir] [--data-dir] [--runtime-dir]
               [--paths] [--json]
               [subcommand]

Jupyter: Interactive Computing

positional arguments:
  subcommand     the subcommand to launch

optional arguments:
  -h, --help     show this help message and exit
  --version      show the jupyter command's version and exit
  --config-dir   show Jupyter config dir
  --data-dir     show Jupyter data dir
  --runtime-dir  show Jupyter runtime dir
  --paths        show all Jupyter paths. Add --json for machine-readable
                 format.
  --json         output paths as machine-readable json

Available subcommands: console kernelspec migrate nbconvert nbextension
notebook qtconsole trust

 2、启动jupyter notebook

   启动jupyter notebook后默认监听于本地8888,如果想外部访问也很简单 

jupyter notebook --ip=x.x.x.x

这样就可从web界面访问了

 3、jupyter notebook web界面的使用

 wKiom1ZG_HPwq8YhAAB3sWrziRU686.png

这些目录都在安装所使用的用户的.ipython的目录下。

如果你不想使用默认的配置参数,可以直接写配置文件,启动服务时引用配置文件。

我们重点说一下python2[右边最后一个功能],其它的一看就知道是什么意思了【2333.。】

打开后与前面的截图是一样的,这可以看作ipython的web界面,但它的功能不止于此,你可以把它当成编辑器,notebook,如果单一的使用ipython或是vim感觉总是缺点什么,但jupyter notebook就将两者结合的很好,当然还可能安装许多额外的扩展更好的支持你所需要的功能。

如果你不知道有那些快捷键可以点help-->Keyboard shortcuts查看支持的快捷键,还可以看帮助引导,分分钟教会你使用[我知道还是上图更有说服力,但太多了,就不操作了,当你安装成功自己找吧]

说的再多也不及你自己安装完成后体验一下。[我在网上见过一个大牛用jupyter写项目。。]