google colab 上的代码折叠

Vla*_*lad 5 jupyter-notebook google-colaboratory

我试过在 google colab 上启用代码折叠

!jupyter nbextension enable codefolding/main
Run Code Online (Sandbox Code Playgroud)

基于此答案并使用此处找到的命令行

然而,对colab的回应是

Enabling notebook extension codefolding/main...
      - Validating: problems found:
        - require?  X codefolding/main
Run Code Online (Sandbox Code Playgroud)

是否可以在 colab 上进行代码折叠?

kHa*_*hit 2

看来您在之后没有执行安装过程的第二步 !pip install jupyter_contrib_nbextensions。还安装 javascript 和 css 文件。

!jupyter contrib nbextension install --user
Run Code Online (Sandbox Code Playgroud)

此步骤将 nbextensions 的 javascript 和 css 文件复制到 jupyter 服务器的搜索目录中,并编辑一些 jupyter 配置文件。