我已經獲得了使用 matplotlib 的 python 腳本,運行腳本時它會打開窗口并顯示圖形。它在我的筆記本電腦上完美運行。但是當我在 AWS elasticbeanstalk 上上傳文件時會發生此錯誤。我通過使用成功地在我的筆記本電腦中重現了這個錯誤import matplotlibmatplotlib.use('agg')從引發的錯誤File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/dates.py", line 1001, in viewlim_to_dt.format(vmin))這是該文件中的代碼def viewlim_to_dt(self): """ Converts the view interval to datetime objects. """ print(self.axis) vmin, vmax = self.axis.get_view_interval() if vmin > vmax: vmin, vmax = vmax, vmin if vmin < 1: raise ValueError('view limit minimum {} is less than 1 and ' 'is an invalid Matplotlib date value. This ' 'often happens if you pass a non-datetime ' 'value to an axis that has datetime units' .format(vmin)) return num2date(vmin, self.tz), num2date(vmax, self.tz)打?。╯elf.axis)顯示這個然后引發錯誤XAxis(100.000000,373.620690)當我刪除行 matplotlib.use('agg') 時, print(self.axis) 顯示x軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000,110.000000)x軸( 200.000000,110.000000)x軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000, 110.000000)x軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000,110.000000) X軸(200.000000,110.000000) X軸(200.000000,110.000000) X軸(200.000000,110.000000)x軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸(200.000000,110.000000)x-軸
1 回答

侃侃無極
TA貢獻2051條經驗 獲得超10個贊
我自己解決了我的問題,通過在我的代碼中注釋掉這一行
plt.ion()
正如我在我的問題中所說,該應用程序在開發環境(在我的筆記本電腦中)中運行,但未在 AWS 服務器上運行。我希望,它可以幫助某人。
添加回答
舉報
0/150
提交
取消