jupyter是一种交互式计算和开发环境的笔记,ipython命令行比原生的python命令行更加友好和高效,还可以运行web版的界面,支持多语言,输出图形、音频、视频等功能。

安装

pip install jupyter

使用

  1.   命令行方式
ipython

  2.   运行shell命令

感叹号!+shell直接运行shell命令,如!pwd
运行python文件

%run test.py(python文件)
魔术函数的使用:
%time a = np.arange()

%quickref 显示IPython的快速参考

%magic 显示所有魔术命令的详细文档
%debug 从最新的异常跟踪的底部进入交互式调试器
%hist 打印命令的输入(可选输出)历史
%pdb 在异常发生后自动进入调试器
%paste 执行剪贴板中的Python代码
%cpaste 打开一个特殊提示符以便手工粘贴待执行的Python代码
%reset 删除interactive命名空间中的全部变量/名称
%page OBJECT 通过分页器打印输出OBJECT
%run script.py 在IPython中执行一个Python脚本文件
%prun statement 通过cProfile执行statement,并打印分析器的输出结果
%time statement 报告statement的执行时间
%timeit statement 多次执行statement以计算系综平均执行时间。对那些执行时 间非常小的代码很有用
%who、%who_ls、%whos 显示interactive命名空间中定义的变量,信息级别/冗余度可变
%xdel variable 删除variable,并尝试清除其在IPython中的对象上的一切引用

  3.  运行web ipython环境

jupyter notebooke --ip=127.0.0.1 --port=

更多参数:

这将启动一个基于tornado的HTML笔记本服务器,它提供一个html5/javascript笔记本客户端。

Subcommands
-----------

Subcommands are launched as `jupyter-notebook cmd [args]`. For information on
using subcommand 'cmd', do: `jupyter-notebook cmd -h`.

list
列出当前运行的Notebook服务.
stop
Stop currently running notebook server for a given port
password
Set a password for the notebook server.

Options
-------

Arguments that take values are actually convenience aliases to full
Configurables, whose aliases are listed on the help line. For more information
on full configurables, see '--help-all'.

--debug
set log level to logging.DEBUG (maximize logging output)
--generate-config
generate default config file
-y
Answer yes to any questions instead of prompting.
--no-browser
在启动服务以后不在浏览器中打开一个窗口.
--pylab
DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib.
--no-mathjax
Disable MathJax

MathJax is the javascript library Jupyter uses to render math/LaTeX. It is
very large, so you may want to disable it if you have a slow internet
connection, or for offline use of the notebook.

When disabled, equations etc. will appear as their untransformed TeX source.
--allow-root
允许notebook在root用户下运行.
--script
DEPRECATED, IGNORED
--no-script
DEPRECATED, IGNORED
--log-level=<Enum> (Application.log_level)
Default: 30
Choices: (0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL')
Set the log level by value or name.
--config=<Unicode> (JupyterApp.config_file)
Default: ''
Full path of a config file.
--ip=<Unicode> (NotebookApp.ip)
Default: 'localhost'
notebook服务会监听的IP地址.
--port=<Int> (NotebookApp.port)
Default: 8888
notebook服务会监听的IP端口.
--port-retries=<Int> (NotebookApp.port_retries)
Default: 50
如果指定的端口不可用,则要尝试其他端口的数量.
--transport=<CaselessStrEnum> (KernelManager.transport)
Default: 'tcp'
Choices: ['tcp', 'ipc']
--keyfile=<Unicode> (NotebookApp.keyfile)
Default: ''
SSL/TLS 私钥文件所在全路径.
--certfile=<Unicode> (NotebookApp.certfile)
Default: ''
SSL/TLS 认证文件所在全路径.
--client-ca=<Unicode> (NotebookApp.client_ca)
Default: ''
用于ssl/tls客户端身份验证的证书颁发证书的完整路径.
--notebook-dir=<Unicode> (NotebookApp.notebook_dir)
Default: ''
用于笔记本和内核的目录。
--browser=<Unicode> (NotebookApp.browser)
Default: ''
Specify what command to use to invoke a web browser when opening the
notebook. If not specified, the default browser will be determined by the
`webbrowser` standard library module, which allows setting of the BROWSER
environment variable to override it.
--pylab=<Unicode> (NotebookApp.pylab)
Default: 'disabled'
DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib.
--gateway-url=<Unicode> (GatewayClient.url)
Default: None
The url of the Kernel or Enterprise Gateway server where kernel
specifications are defined and kernel management takes place. If defined,
this Notebook server acts as a proxy for all kernel management and kernel
specification retrieval. (JUPYTER_GATEWAY_URL env var)

To see all available configurables, use `--help-all`

Examples
--------

jupyter notebook # start the notebook
jupyter notebook --certfile=mycert.pem # use SSL/TLS certificate
jupyter notebook password # enter a password to protect the server

  常用命令:

    1.  查看配置文件

jupyter notebook --generate-config

    如果配置文件不存在, 创建

ipython profile create

  常用快捷键:

  • 执行当前cell,并自动跳到下一个cell:Shift Enter
  • 执行当前cell,执行后不自动调转到下一个cell:Ctrl-Enter
  • 为一行或者多行添加/取消注释:Crtl /<br>打开帮助,Ctrl+Shirt+P

  1. 添加代码自动补全

pip install jupyter_contrib_nbextensions

安装完成,需要配置
jupyter contrib nbextension install --user --skip-running-check 启动jupyter notebook 页面上会出现 Nbextensions
勾选 Hinterland即可 具体使用的时候, 使用tab进行代码补全操作

  2. 显示行号

  查看 > 切换行号

  3. 以守护进程方式运行

nohup jupyter notebook --ip=0.0.0.0 --port= --allow-root > /dev/null >& &

  4. 设置登陆密码

Jupiter notebook password

  常见错误:

  1. python - Jupyter error: "No module named jupyter_core.paths"

  重新安装jupyter

  2. ImportError: No module named '_sqlite3'

Traceback (most recent call last):
File "decode_conv.py", line , in <module>
import sqlite3
File "/usr/local/lib/python3.5/sqlite3/__init__.py", line , in <module>
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.5/sqlite3/dbapi2.py", line , in <module>
from _sqlite3 import *
ImportError: No module named '_sqlite3'

  解决:

  

# 先安装 sqlite-devel
yum install sqlite-devel # 之后需要将Python基于代码的安装包重新编译一下,并重新安装之后
./configure –prefix=python-install-folder
make & make install
 
 
 
 
 
 

python之jupyter notebook的更多相关文章

  1. 基于Ubuntu+Python+Tensorflow+Jupyter notebook搭建深度学习环境

    基于Ubuntu+Python+Tensorflow+Jupyter notebook搭建深度学习环境 前言一.环境准备环境介绍软件下载VMware下安装UbuntuUbuntu下Anaconda的安 ...

  2. 简说Python之Jupyter Notebook

    目录 简说Python之Jupyter Notebook 1.Jupyter Notebook 系统环境:Ubuntu 18.04.1 LTS Python使用的是虚拟环境:virutalenv Py ...

  3. Python神器 Jupyter Notebook

    什么是Jupyter Notebook? 简介 Jupyter Notebook是基于网页的用于交互计算的应用程序.其可被应用于全过程计算:开发.文档编写.运行代码和展示结果. Jupyter Not ...

  4. Python - 搭建Jupyter notebook环境

    1- Jupyter简介 HomePage:https://jupyter.org/ 安装指南:https://jupyter.org/install.html 官方文档:https://jupyte ...

  5. 安装python的jupyter notebook工具

    jupyter notebook是一个通过网页运行python的工具 支持分段的python运行,并能直观的查看结果 支持多python环境运行,需要加装(conda) 安装步骤 1.安装python ...

  6. python+pandas+jupyter notebook 的 hello word

  7. anaconda 环境新建/删除/拷贝 jupyter notebook上使用python虚拟环境 TensorFlow

    naconda修改国内镜像源 国外网络有时太慢,可以通过配置把下载源改为国内的通过 conda config 命令生成配置文件,这里使用清华的镜像: https://mirrors.tuna.tsin ...

  8. Python·Jupyter Notebook各种使用方法记录

    标签(空格分隔): Python 一 Jupyter NoteBook的安装 1 新版本Anaconda自带Jupyter 2 老版本Anacodna需自己安装Jupyter 二 更改Jupyter ...

  9. 【Python】和【Jupyter notebook】的正确安装方式?

    学了那么久Python,你的Python安装方式正确吗?今天给你看看什么才是Python正确的安装方式,教程放在下面了,喜欢的记得点赞. Python安装 Python解答Q群:660193417## ...

随机推荐

  1. 发布js插件zhen-chek(用来检测数据类型)到npm上

    今天想到js本身是弱类型,在实际项目中很多时候需要数据类型检测.于是打算做一个判断数据类型的js插件,发布到npm上面. 基本思路: 1,输入参数,便返回数据类型,所有数据类型如下 '[object ...

  2. docker进入容器的四种方法

    在使用Docker创建了容器之后,大家比较关心的就是如何进入该容器了,其实进入Docker容器有好几多种方式,这里我们就讲一下常用的几种进入Docker容器的方法. 进入Docker容器比较常见的几种 ...

  3. easyUI之练习

    <%@ page language="java" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC & ...

  4. C# 打包安装部署 属性中找不到 查找目标或打开文件位置

    用第三方工具OrcaMis (一个可以修改msi文件的工具)来实现的 最后我又试了几次,以为是再程序打包的时候设置有问题,结果都没有找到原因,没有办法只有需求网络资源,网络上有朋友说VS创建的快捷方式 ...

  5. 大数据HIve

    1. 题目说明 设计题:MySQL数据库A有1000w条数据,完成统计再输入到另外的B表中 A表 test1 0.2,3.5,1,1test1 1.2,2.3,4.56test2 2.1,0.3,9. ...

  6. 一台物理机器一个IP配置多个域名多套程序的方法

    1.安装nginx cd /usr/local/ wget http://nginx.org/download/nginx-1.2.8.tar.gz tar -zxvf nginx-1.2.8.tar ...

  7. 如果Mysql插入字符始终乱码怎么办?

    1.找到my.cnf [root@Sliver-Code ~]# vi /etc/my.cnf 加入下面三行语句 [client] default-character-set=utf8 [mysqld ...

  8. PowerDesigner通过SQL语句生成PDM文件并将name和comment进行互相转换

    本篇文章主要介绍了PowerDesigner通过SQL语句生成PDM文件并将name和comment进行互相转换 超详细过程(图文),具有一定的参考价值,感兴趣的小伙伴们可以参考一下 1.软件准备 软 ...

  9. 【图像处理】H.264开源解码器评测

    转自:http://wmnmtm.blog.163.com/blog/static/38245714201142883032575/ 要播放HDTV,就首先要正确地解开封装,然后进行视频音频解码.所以 ...

  10. eval 命令

    eval命令用于重新运算求出参数的内容. eval可读取一连串的参数,然后再依参数本身的特性来执行. 语法: eval [参数]示例:eval echo 123