zoukankan      html  css  js  c++  java
  • 安装使用jupyter

    介绍

    jupyter是IPython剥离出来成为一个语言无关的独立软件包。

    jupyter已经支持50多种语言的内核,包括Lisp、R、F#、Perl、Ruby、Scala等。事实上即使IPython本身也是一个jupyter Python模块。提供 REPL(读取,求值,打印循环)交互式开发环境,类似于nrepl或SLIME。

    依赖

    • python
    • pip
    • virtualenv: python资源隔离工具包,用于创建隔离的专属python环境

    安装

    pip

    wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-12.0.3.tar.gz#md5=f07e4b0f4c1c9368fcd980d888b29a65
    tar -zxvf setuptools-12.0.3.tar.gz
    cd setuptools-12.0.3
    python setup.py install
    
    wget --no-check-certificate https://github.com/pypa/pip/archive/1.5.5.tar.gz
    tar zvxf 1.5.5.tar.gz  
    cd pip-1.5.5/
    python setup.py install
    

    virtualenv

    pip install virtualenv
    
    

    创建虚拟环境

    找一个你喜欢的目录创建虚拟环境,并激活

    mkdir jupyter
    cd jupyter
    virtualenv venv --python=python2.7
    source ./venv/activate
    
    退出虚拟环境
    source ./venv/deactivate
    

    安装,配置,启动 jupyter notebook

    pip install jupyter
    jupyter notebook --generate-config # 生成配置文件
    

    输入ipython命令,依次敲入如下代码,并输入网站访问时需要填写的密码

    In [1]: from notebook.auth import passwd
    In [2]: passwd()
    Enter password:
    Verify password:
    Out[2]: 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'
    openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mykey.key -out mycert.pe # 产生秘钥
    

    修改配置文件

    vim ~/.jupyter/jupyter_notebook_config.py
    
    # Set options for certfile, ip, password, and toggle off browser auto-opening
    c.NotebookApp.certfile = u'/absolute/path/to/your/certificate/mycert.pem'
    c.NotebookApp.keyfile = u'/absolute/path/to/your/certificate/mykey.key'
    # Set ip to '*' to bind on all interfaces (ips) for the public server
    c.NotebookApp.ip = '*'
    c.NotebookApp.password = u'sha1:bcd259ccf...<your hashed password here>'
    c.NotebookApp.open_browser = False
    
    # It is a good idea to set a known, fixed port for server access
    c.NotebookApp.port = 9999
    

    启动服务

    jupyter notebook # 启动服务
    

    数据分析和数据挖掘常用包

    创建文件 requirements.txt 内容如下

    numpy
    matplotlib
    scipy
    pandas
    scikit-learn
    
    

    执行命令

    python -m pip install -r requirements.txt -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
    

    最后我们来看看界面

    生产环境

    如果你没有sodu权限,怎么安装需要的一些python包

    • 下载 virtualenv

    file

    tar xvfz virtualenv-15.1.0.tar.gz
    cd virtualenv-15.1.0
    python virtualenv.py  --python=python包的位置  ~/venv
    source activate
    
  • 相关阅读:
    联想 Vibe Shot(Z90-3) 免recovery 获取ROOT权限 救砖 VIBEUI V3.1_1625
    联想 Z5S(L78071)免解锁BL 免rec 保留数据 ROOT Magisk Xposed 救砖 ZUI 10.5.370
    联想 Z5(L78011) 免解锁BL 免rec 保留数据 ROOT Magisk Xposed 救砖 ZUI 10.5.254
    联想 S5 Pro(L78041)免解锁BL 免rec 保留数据 ROOT Magisk Xposed 救砖 ZUI 5.0.123
    第二阶段 冲刺八
    第二阶段 冲刺七
    第二阶段 冲刺六
    第二阶段 冲刺五
    代码大全阅读笔记03
    学习进度十二
  • 原文地址:https://www.cnblogs.com/duanxingxing/p/6553227.html
Copyright © 2011-2022 走看看