我有以下的Hello World代码来尝试在我的Mac上使用matplotlib进行TeX渲染。在Mac OS X和TeX Live的matplotlib中使用TeX
import matplotlib.pyplot as plt
from matplotlib import rc
rc('text', usetex=True)
rc('font', family='serif')
plt.text(2,2,r"Hello World!")
plt.show()
与该代码,我会收到以下错误:
sh: latex: command not found
Exception in Tkinter callback
<... a long Traceback here ...>
RuntimeError: LaTeX was not able to process the following string:
'lp'
Here is the full report generated by LaTeX:
我看不出有什么样的完整报告的最后一行之后。无论如何,我认为这是一个路径问题。关于我如何修复它的一些指示?我有TeX Live 2010.
我尝试将/Library/TeX/Root/bin/universal-darwin
添加到项目属性的全局Python路径,但我仍然收到相同的错误。
权有关NetBeans的一部分。这是我本周就同一主题提出的第三个问题。我以为我已经把它放进去了。我也不能添加'/ usr/texbin',这是我从终端上的'latex'获得的。点击“添加...”不会让我手动输入路径。你能举一个如何使用'os.environ'的例子吗?文档中的[entry](http://docs.python.org/library/os.html#process-parameters)没有使用示例。 – Kit 2011-05-21 14:21:18
os.environ只是一个Python字典。你可以像任何其他操作一样。 – 2011-05-21 14:55:40
我现在明白了。 'os.environ ['PATH'] = os.environ ['PATH'] +':/ usr/texbin''谢谢! – Kit 2011-05-21 23:56:19