Python Jupyter - 更改默认字体

问题描述 投票:0回答:4

我想更改 Jupyter 中显示的默认字体(更改为 Gill sans),但我不知道在哪里编辑它。

我查看了 .ipython 文件夹,没有 Static 文件夹,我查看了 .jupyter 文件夹,它是空的。

有人知道吗?

python ipython jupyter
4个回答
18
投票

您可以通过向文件中添加值来修改Jupyter笔记本的样式;

.jupyter\custom\custom.css

如果

custom
目录不在
.jupyter
中,只需创建它并在其中添加
custom.css
即可。

在新的空白

custom.css
文件中,您可以添加类似的内容来更改代码镜像的字体;

.CodeMirror pre, .CodeMirror-dialog, .CodeMirror-dialog .CodeMirror-search-field, .terminal-app .terminal {
    font-family: YOUR-FAV-FONT;
    font-size: 12pt;
}

这里是一个 拉皮条的 custom.css 的示例。它来自我在 github 上的 one-dark-notebook repo。请随意克隆/分叉它并做任何事情。


5
投票

您可以从命令行更改字体大小、背景主题、单元格宽度等。查看以下 GitHub 页面。 https://github.com/dunovank/jupyter-themes


3
投票

您可以在/.jupyter/jupyter_qtconsole_config.py 或从命令行设置默认字体。查看此文档(第 23 页)以获取命令行示例 https://media.readthedocs.org/pdf/qtconsole/latest/qtconsole.pdf


0
投票

您可以使用 Jupyter 文件资源管理器部分中提供的

Settings Editor
更新 Jupyter 设置,例如字体系列、字体大小和缩进。

可以修改代码编辑器(在后台使用

CodeMirror
)、代码控制台甚至 CSV 查看器的设置。

Jupyter's Setting Editor

如果您觉得编辑底层 JSON 文件更舒服,您还可以切换“设置”视图以使用右上角的

JSON Settings Editor

JSON Editor for Jupyter's Settings

通过这种方式,您可以像 VSCode 一样调整设置。

Editing CodeMirror Settings

记得点击所需的插件,在本例中为 CodeMirror。

© www.soinside.com 2019 - 2024. All rights reserved.