[英]Failing to use the GTK3Agg Matplotlib backend in Jupyter Notebook
我正在使用 Jupyter Notebook(Python 3.9.7、Matplotlib 3.4.3、Anaconda 4.11.0)。 我正在尝试在 Jupyter Notebook 中使用以下 Matplotlib 自定义配置:
backend : GTK3Agg
savefig.dpi : 300
savefig.format : pdf
figure.figsize : 4,4
xtick.top : True
ytick.right : True
xtick.minor.visible : True
ytick.minor.visible : True
ytick.direction : in
xtick.direction : in
xtick.major.size : 6 # default 3.5
ytick.major.size : 6 # default 3.5
xtick.minor.size : 3 # default 2
ytick.minor.size : 3 # default 2
xtick.major.width : 0.6 # default 0.8
ytick.major.width : 0.6 # default 0.8
xtick.minor.width : 0.6 # default 0.6
ytick.minor.width : 0.6 # default 0.6
axes.linewidth : 0.6 # default 0.8
lines.linewidth : 0.6 # default 1.5
lines.markeredgewidth : 0.3 # default 1
xtick.major.pad : 4 # default 3.5
ytick.major.pad : 4 # default 3.5
xtick.minor.pad : 4 # default 3.5
ytick.minor.pad : 4 # default 3.5
legend.frameon : False
legend.handletextpad : 0.5
text.usetex : True
text.latex.preamble : \usepackage{cmbright}
通过将具有此类内容的matplotlibrc
文件添加到我正在使用的目录中。但是当我尝试使用 pyplot 对 plot 进行某些操作时,我总是会收到以下错误:
RuntimeError: latex was not able to process the following string:
b'lp'
Here is the full report generated by latex:
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=latex)
restricted \write18 enabled.
entering extended mode
(/home/garpez/.cache/matplotlib/tex.cache/097ed497d104170bb1494fe23d4d7e20.te
x
LaTeX2e <2020-02-02> patch level 2
L3 programming layer <2020-02-14>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/type1cm/type1cm.sty)
(/usr/share/texmf/tex/latex/cm-super/type1ec.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/t1cmr.fd))
(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty)
(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/generic/iftex/ifvtex.sty
(/usr/share/texlive/texmf-dist/tex/generic/iftex/iftex.sty)))
! LaTeX Error: File `cmbright.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
Enter file name:
! Emergency stop.
<read *>
l.12 \makeatletter
\@ifpackageloaded{textcomp}{}{\usepackage{textcomp}}\makea...
No pages of output.
一位同事似乎拥有相同版本的相同库,并且对他来说一切正常。 我的理解是我得到的错误与带有 GTK3Agg 后端的 latex 编译器有关。 和我的同事一样,我已经安装了 cairo 1.16.0、latex 0.7.0。 我究竟做错了什么? 我觉得这里缺少一些东西。
问题不python
, matplotlib
或jupyter-notebook
,而是LaTeX
问题:
LaTeX Error: File `cmbright.sty' not found.
解决方案是安装所需的.sty
文件。 在这种情况下,您可以从 CTAN 下载并解压它,或者安装 package texlive-fonts-extra
sudo apt install texlive-fonts-extra
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.