Jupyter

jupyter命令一览。

输出去掉 \nhttps://stackoverflow.com/questions/43835171/print-multiple-line-string-in-jupyter-notebook

http://jupyter.org/

pip install jupyter --user 安装
jupyter notebook 进入笔记本

修改默认路径和浏览器

Windows默认在chrome里面打开:
1.命令行:jupyter notebook –generate-config
2.打开文件:jupyter_notebook_config.py
3.在文件头部添加:

1
2
3
import webbrowser
webbrowser.register('chrome', None, webbrowser.GenericBrowser(u'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'))
c.NotebookApp.browser = 'chrome'

路径需要酌情调整。

在nbviewer中查看

github文件的网址中把https://github.com 替换为https://nbviewer.jupyter.org/github
注意斜线个数。典型示例https://nbviewer.jupyter.org/github/cjql/myjupyter/blob/master/MySQL.ipynb
官方网站

格式转换: html、md、pdf、letex

参考链接

格式转换

后续

官方文档
腾讯云入门教程1 英文参考文献
腾讯云入门教程2 英文参考文献

命令式

命令 功能
jupyter nbconvert –to html notebook.ipynb ipynb转为html格式
jupyter nbconvert –to html –template full notebook.ipynb 对生成的html格式进行配置,默认配置,提供完整的静态html格式,交互性更强。
jupyter nbconvert –to html –template basic notebook.ipynb 简化的html,用于嵌入网页、博客等,这不包括html标题。
jupyter nbconvert –to md notebook.ipynb 简单的Markdown格式输出,cell单元不受影响,代码cell缩进4个空格。
jupyter nbconvert –to letex notebook.ipynb Letex导出格式,生成后缀名为NOTEBOOK_NAME.tex的文件。
jupyter nbconvert –to letex -template article notebook.ipynb 默认配置,Latex文章。
jupyter nbconvert –to letex -template report notebook.ipynb Latex报告,提供目录和章节。
jupyter nbconvert –to letex -template basic notebook.ipynb 最基本的Latex输出,经常用来自定义配置。
jupyter nbconvert –to pdf notebook.ipynb 转换为pdf格式分模板配置与latex配置是一样的。需要提前安装xelatex。
sudo apt-get install texlive-full 方法是安装texLive套装,texlive-full的安装包有点大,约1G多。

面板式

ipynb转换为html、md、pdf等格式,还有另一种更简单的方法:在jupyter notebook中,选择File->Download as,直接选择需要转换的格式就可以了。需要注意的是,转换为pdf格式之前,同样要保证已经安装了xelatex。

文章目录
  1. 修改默认路径和浏览器
  • 在nbviewer中查看
  • 格式转换: html、md、pdf、letex
    1. 参考链接
    2. 后续
    3. 命令式
    4. 面板式
  • |