如何让python matplotlib mathtext在centos7/rhel7上工作?

2024-04-25 22:44:37 发布

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

在centos7/rhel7上,我尝试使用文档中的一个示例进行简单的绘图:

#!/usr/bin/env python2
import numpy as np
import matplotlib.pyplot as plt
plt.plot(np.arange(10))
plt.title(r'$\alpha > \beta$')
print plt.__version__
plt.show()
  • matplotlib.__version__显示1.2.0(从RPM安装)
  • plt.rcParams['text.usetext']设置为False

我没有看到预期的希腊字母alpha和beta,而是看到:*©@

我不想安装latex。我不想使用anaconda python发行版

如何让matplotlib mathtext在centos7/rhel7上工作?

另外,我尝试了plt.rcParams['text.usetext'] = True,但得到了一个sh latex command not found错误(latex显然没有安装)


Tags: text文档importalphamatplotlibversionasnp