我最近將我的筆記本電腦升級到Snow Leopard,TeX升級到版本3.1415926(TeX Live 2011/MacPorts 2011_5),並安裝了Python 2.7.3。完成所有這些安裝後,我運行macport selfupdate和macport upgrade過期。但是,現在當我嘗試在matplotlib使用TeX的,我收到以下內容:Python:無法渲染Matplotlib中的Tex
LaTeX was not able to process the following string:'lp'
Here is the full report generated by LaTeX:
This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011/MacPorts 2011_5)
restricted \write18 enabled.
entering extended mode (./64a53cc27244d5ee10969789771e33fa.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, dumylang, nohyphenation, cz
ech, slovak, dutch, ukenglish, usenglishmax, basque, french, german-x-2009-06-1
9, ngerman-x-2009-06-19, german, ngerman, swissgerman, italian, polish, portugu
ese, spanish, catalan, galician, ukenglish, loaded.
(/opt/local/share/texmf-texlive-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/opt/local/share/texmf-texlive-dist/tex/latex/base/size10.clo))
! LaTeX Error: File `type1cm.sty' not found.
Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: sty)
l.3 \renewcommand
{\rmdefault}{pnc}^^M
No pages of output.
類似this previous question,我試圖通過設置在我的Python代碼路徑:
os.environ['PATH'] = os.environ['PATH'] + ':/opt/local/bin/latex'
因爲which latex
產生/opt/local/bin/latex
。但是,這不起作用,同樣的錯誤消息。我也試過了tex的路徑,以及上一個問題的例子。不用找了。
我又試圖通過強行可能缺少的包:
matplotlib.rcParams['text.latex.preamble']=[r"\usepackage{amsmath}"]
然而
,也沒有工作。
我可以讓我的地塊工作的唯一方法是說rc('text', usetex=False)
,這是不理想的。任何幫助將非常感激。
這個固定爲我'sudo易於得到我的Ubuntu 13.10的機器上安裝dvipng' – 2016-07-06 23:41:21