尝试使用LaTeX渲染matplotlib文本时找不到文件/目录

Wil*_*gyi 5 python latex matplotlib

我试图用乳胶,这样我可以加入我的LaTeX文档本地外观的情节呈现在matplotlib文字,如下所述:https://matplotlib.org/1.3.1/users/usetex.html

我安装了LaTeX,dvipng和Ghostscript,并且我检查了可执行文件是否在我的PATH(在matplotlib文档中指定)但是当我运行以下测试时它返回

  File "/Users/wilf/anaconda3/lib/python3.6/subprocess.py", line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)

FileNotFoundError: [Errno 2] No such file or directory: 'latex': 'latex'
Run Code Online (Sandbox Code Playgroud)

测试代码就是

import matplotlib as plt
plt.rc('text', usetex=True)
plt.rc('font', family='serif')

plt.pyplot.plot([1, 2, 3], [1, 2, 3])
plt.pyplot.xlabel('x')
plt.pyplot.ylabel('y')
Run Code Online (Sandbox Code Playgroud)

我不确定为什么它会给我这个错误,或者我如何解决它.