"无法找到文件/目录:尝试使用LaTeX渲染matplotlib文本"

2024-04-28 22:33:08 发布

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

我尝试使用LaTeX在matplotlib中呈现文本,这样我就可以在我的LaTeX文档中包含原生的绘图,如下所述: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'

测试代码只是

^{pr2}$

我不知道它为什么会给我这个错误,也不知道我怎样才能修正它。在


Tags: 文档httpsorg文本child绘图matplotlibhtml