[异常]Failed to process string with tex because latex could not be found

环境:anaconda
使用jupyter notebook尝试plt.text()报出异常:RuntimeError: Failed to process string with tex because latex could not be found

尝试解决方法:
pip install latex
安装成功

运行仍旧报出该异常。

到anaconda的官方网站搜索,找到答案
https://anaconda.org/conda-forge/jupyter_latex_envs
按照步骤:
conda install -c conda-forge jupyter_latex_envs
conda install -c conda-forge/label/cf201901 jupyter_latex_envs
conda install -c conda-forge/label/cf202003 jupyter_latex_envs
成功后,问题得到解决。

import matplotlib.pyplot as plt
fig = plt.figure()
plt.axis([0, 10, 0, 10])
t = ("ACEACEACE\n "
     "ACEACE\n "
     "ACE")
plt.text(6, 1, t, ha='left', rotation=15, wrap=True)
plt.text(1, 5, t, ha='left', rotation=15, wrap=True)
plt.text(5, 5, t, ha='right', rotation=-15, wrap=True)
plt.text(5, 10, t, fontsize=18, style='oblique', ha='center',
         va='top', wrap=True)
plt.text(10, 4, t, family='serif', style='italic', ha='right', wrap=True)
plt.text(-1, 0, t, ha='left', rotation=-15, wrap=True)

[异常]Failed to process string with tex because latex could not be found_第1张图片
终于可以加文字了,随便写个位置探索一下用法。

你可能感兴趣的:(python,anaconda)