Python Jupyter - 更改默认字体

Python Jupyter - Change default font

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

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

有人知道吗?

您可以通过在文件中添加值来修改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;
}

这是 github 上 pimped out custom.css. It's from my one-dark-notebook repo 的示例。随意clone/fork它并做任何事情。

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

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