运行时错误:latex无法处理以下字符串:b“$1.0$”

2024-04-26 03:28:43 发布

您现在位置:Python中文网/ 问答频道 /正文

MCVE公司:

import matplotlib.pyplot as plt
from matplotlib import rc

plt.rc('text', usetex = True)
plt.plot([1.0, 2.0], [3.0, 4.0])
plt.show()

抛出的错误如标题所述:

^{pr2}$

由于usetex设置设置为True,因此引发错误。如果设置为False,则不会发生错误。在

我不知道为什么会发生这种情况,我想(不确定)几周前同样的代码也能正常工作。在

添加更多信息:

代码在一行中指出了错误:

exc=exc.output.decode('utf-8')))

Tags: 代码textfromimporttruematplotlibas错误

热门问题