如何优雅地使用 Jupyter?

 

一、给Jupyter换主题

1. 更新jupyter-core

这里首先要更新jupyter-core到最新的4.4.0版本,同时要注意直接用pip更新会报错

Cannot uninstall 'jupyter-core'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

这里需要使用--ignore-installed: pip install jupyter-core --ignore-installed jupyter-core

2. 下载jupyter-themes

pip install jupyterthemes

3.打开主题列表

打开jupyter-notebook,加载主题列表

!jt -l
Available Themes: 
   chesterish
   grade3
   gruvboxd
   gruvboxl
   monokai
   oceans16
   onedork
   solarizedd
   solarizedl

4. 选择主题

# selecting a particular theme
!jt -t <name of the theme> -T -N
# reverting to original Theme
!jt -r

5. 重新加载一次Jupyter

!jt -t oceans16  -T -N

其实还是原始的好看QAQ

 

二、安装nbextensions

1. 安装jupyter_contrib_nbextensions 

jupyter_contrib_nbextensions 

2. 启用jupyter_contrib_nbextensions

jupyter contrib nbextension

3. 重新加载jupyter,并选用以下插件

Hinterland: 自动补齐

 

 Snippets: 直接插入代码段

 

Autopep8: 美化代码格式

 

三、 幻灯片格式

1. 幻灯片

jupyter nbconvert *.ipynb --to slides --post serve

在端口段会显示ppt

2. RISE

下载RISE

conda install -c damianavila82 rise

运行加载RISE

jupyter-nbextension install rise --py --sys-prefix
#enable the nbextension:
jupyter-nbextension enable rise --py --sys-prefix

 

四、嵌入pdf和网页

1. 嵌入pdf

from IPython.display import IFrame
IFrame('https://arxiv.org/pdf/1406.2661.pdf', width=800, height=450)

2.嵌入网页

from IPython.display import IFrame
IFrame('https://en.wikipedia.org/wiki/HTTPS', width=800, height=450)

 

 

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值