Python 使用matplotlib在tex模式下使用粗体字体

Python 使用matplotlib在tex模式下使用粗体字体,python,python-2.7,matplotlib,latex,Python,Python 2.7,Matplotlib,Latex,在阅读了许多关于这个主题的帖子后,我决定使用以下代码 from matplotlib import rc, rcParams ... rc('text', usetex=True) rcParams['text.latex.preamble']=[r"\usepackage{amsmath}"] grid.axes_llc.set_ylabel(r"$\mathbf{Im(\boldsymbol{\alpha})}$", weight='bold', size='18') 这会产生以下错误:

在阅读了许多关于这个主题的帖子后,我决定使用以下代码

from matplotlib import rc, rcParams
...
rc('text', usetex=True)
rcParams['text.latex.preamble']=[r"\usepackage{amsmath}"]
grid.axes_llc.set_ylabel(r"$\mathbf{Im(\boldsymbol{\alpha})}$", weight='bold', size='18')
这会产生以下错误:

RuntimeError: dvipng was not able to process the following file:
/home/lab/.cache/matplotlib/tex.cache/92589d6907b2844de9b825e2eaeaa998.dvi
Here is the full report generated by dvipng: 

报告是空的!我已经尝试将latex目录添加到路径中。我在ubuntu上使用Python2.7。如何使其理解“\boldsymbol”命令?或者我还能做些什么来将希腊字体加粗?

我们可能更容易提供帮助,如果您将此转化为一个错误,我无法使用
plt.text
ax.set\ylabel
再现该错误。你确定你的乳胶环境没有问题吗?