下面的问题似乎只发生在Spyder IDE上,当我从命令行运行脚本时,它不会发生。
尝试在Python 2.7.12中使用pyplot绘制一个简单的图|Anaconda自定义(64位)|:
import matplotlib.pyplot as plt
plt.plot(x,y)
我收到了以下信息:
sh: 1: dvipng: not found
Traceback (most recent call last):
File "/home/ohm/anaconda2/lib/python2.7/site-packages/matplotlib/backends/backend_qt5agg.py", line 176, in __draw_idle_agg
FigureCanvasAgg.draw(self)
File "/home/ohm/anaconda2/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 474, in draw
self.figure.draw(self.renderer)
File "/home/ohm/anaconda2/lib/python2.7/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/home/ohm/anaconda2/lib/python2.7/site-packages/matplotlib/figure.py", line 1159, in draw
func(*args)
File "/home/ohm/anaconda2/lib/python2.7/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/home/ohm/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 2324, in draw
a.draw(renderer)
File "/home/ohm/anaconda2/lib/python2.7/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/home/ohm/anaconda2/lib/python2.7/site-packages/matplotlib/axis.py", line 1111, in draw
tick.draw(renderer)
File "/home/ohm/anaconda2/lib/python2.7/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/home/ohm/anaconda2/lib/python2.7/site-packages/matplotlib/axis.py", line 252, in draw
self.label1.draw(renderer)
File "/home/ohm/anaconda2/lib/python2.7/site-packages/matplotlib/artist.py", line 61, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/home/ohm/anaconda2/lib/python2.7/site-packages/matplotlib/text.py", line 792, in draw
mtext=mtext)
File "/home/ohm/anaconda2/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 253, in draw_tex
Z = texmanager.get_grey(s, size, self.dpi)
File "/home/ohm/anaconda2/lib/python2.7/site-packages/matplotlib/texmanager.py", line 583, in get_grey
pngfile = self.make_png(tex, fontsize, dpi)
File "/home/ohm/anaconda2/lib/python2.7/site-packages/matplotlib/texmanager.py", line 524, in make_png
'dvipng: \n\n' % dvifile + report)
RuntimeError: dvipng was not able to process the following file:
/home/ohm/.cache/matplotlib/tex.cache/d0e4b65f3cbceaa40d39cd0b4aa94322.dvi
Here is the full report generated by dvipng:
有人知道这是怎么回事吗?
1条答案
按热度按时间dy1byipe1#
请确保第一个
dvipng
安装在spyder外部。这可以通过以下方式完成。在unix系统(Mac OSX、LINUX)上,请转到终端,并输入(Windows power shell中提供了类似的命令)。此命令将
1.返回一个错误,在这种情况下,您必须首先安装
dvipng
,安装过程完全取决于您的操作系统或
1.返回路径,例如
/usr/bin/texlive/dvipng
(确切路径可能会有所不同)。如果是1.,安装
dvipng
。这可能会解决您的问题。如果不是,请转到说明的开头。如果您已经安装了dvipng
,您将在2.中结束。如果2.,则从
spyder
内这将使
python
知道命令dvipng
。请原谅延迟回答此问题。