6

我正在尝试在新计算机上安装出色的目录扩展。但我再也找不到了。我找到的唯一页面没有解释如何在 Windows 上安装扩展。

那么..我该如何安装它,为什么它不是官方 Ipython 笔记本的一部分?我简直无法理解没有它人们是如何相处的。

4

4 回答 4

7

我最近 使用Jupyter 4(即 ipython notebook 4)成功安装了toc nbextension 。事实上安装扩展比以前更容易:)

我在这里发布我的解决方案,可能会有所帮助。

## download 
mkdir toc
cd toc
wget https://raw.githubusercontent.com/minrk/ipython_extensions/master/nbextensions/toc.js
wget https://raw.githubusercontent.com/minrk/ipython_extensions/master/nbextensions/toc.css

## install and enable
cd ..
jupyter-nbextension install --user toc
jupyter-nbextension enable toc/toc

再解释一下:

install将复制toc~/.local/share/jupyter/nbextensions/

enable将修改~/.jupyter/nbconfig/notebook.json.

你可以检查这两个地方看看发生了什么。

注意:我们enable toc/toc在这里使用是因为toc.jsis in ~/.local/share/jupyter/nbextensions/toc/。如果你把toc.jsandtoc.css直接放进去,~/.local/share/jupyter/nbextensions/那么你应该enable toc在这里使用。

编辑

抱歉,我没有注意到原来的问题出在 Windows 上。我不确定 Windows jupyter 是否相同,欢迎任何报告。

更新

现在 toc nbextension 已添加到此项目中,它提供了一系列 nbextensions。非常易于安装和管理,值得一试!

于 2015-10-10T08:09:00.283 回答
3

我不能告诉你具体的 Windows 建议,但认为关键点应该与平台无关:

  1. 创建一个配置文件(默认配置文件或命名的配置文件 - 您可能希望默认启动)。
  2. 找到配置文件所在的位置。
  3. 将文件添加custom.js到配置文件中。
  4. 编辑custom.js文件以指向笔记本扩展代码。

更详细一点,此处详细介绍了设置配置文件,但对于默认配置文件,只需转到命令行并输入

ipython profile

接下来,通过在命令行键入来定位您的个人资料的存储位置

ipython locate

叫那个<profile_dir>

其余的遵循(Windows 等价于!)您拥有的链接上的说明:在下面<profile_dir>导航到(创建任何尚不存在的目录)

<profile_dir>/static/custom/

并添加custom.js文件,如图所示。然后编辑第一行,它必须"nbextensions/toc"指向您放置toc.js已下载文件的位置。这个位置是相对于<profile_dir>; 对我来说我有

<profile_dir>/static/custom/custom.js
<profile_dir>/static/custom/nbextensions/toc.js
<profile_dir>/static/custom/nbextensions/toc.css

和 custom.js 的第一行读取

require(["/static/custom/nbextensions/toc.js"], function (toc) {

最后,请注意,这是笔记本的 1.1.0 版本 - 如果您使用的是早期版本,我强烈建议您在尝试之前升级。

于 2014-01-17T16:05:28.557 回答
1

您还可以在以下位置找到官方安装说明:

https://github.com/minrk/ipython_extensions

这些说明包括用于从 GitHub 检索 toc.js 和 toc.css 文件的 curl 命令,这对我来说在 linux Mint 上的 bash shell 中运行良好。

对于 Windows 7,我使用 Git Shell(请参阅http://msysgit.github.io/)来执行 curl 命令

于 2014-08-20T08:17:02.467 回答
0

这个 IPython Notebook在 Windows 中半自动生成 minrk 目录的文件。它不使用“curl”命令或链接,而是将 *.js 和 *.css 文件直接写入您的 IPython Notebook-profile-directory。

笔记本中有一个名为“你需要做什么”的部分- 遵循它并有一个漂亮的浮动目录:)

这是一个已经显示的 html 版本: http ://htmlpreview.github.io/?https://github.com/ahambi/140824-TOC/blob/master/A%20floating%20table%20of%20contents.htm

于 2014-08-24T13:34:31.170 回答