我正在與Arduino一起使用氣象站項目,我需要運行一個運行Ubuntu服務器的計算機上開發的python程序(click here)。我通過SSH連接到計算機。 SSH客戶端是Windows 7筆記本電腦,我使用的軟件稱爲PuTTY。Ubuntu服務器和SSH上的matplotlib錯誤
當我運行Python程序,我得到了以下錯誤:
Traceback (most recent call last):
File "plot_norm.py", line 9, in <module>
fig1 = plt.figure(1)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 535, in figure
**kwargs)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 81, in new_figure_manager
return new_figure_manager_given_figure(num, figure)
File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 89, in new_figure_manager_given_figure
window = Tk.Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1818, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
我如何修正這個錯誤?
它的工作詳細說明(我用的matplotlib.use( '此Agg')),但現在我的代碼似乎忽視了anf1 = anim.FuncAnimation(FIG1,animatef1,間隔= 45000)和anf2 = anim.FuncAnimation(fig2,animatef2,interval = 45000)行代碼。 –