看板 Python 關於我們 聯絡資訊
$HOME=/root CONFIGDIR=/root/.matplotlib matplotlib data path /usr/local/lib/python2.6/site-packages/matplotlib/mpl-data loaded rc file /root/.matplotlib/matplotlibrc matplotlib version 0.98.5.2 verbose.level helpful interactive is False units is False platform is linux2 Using fontManager instance from /root/.matplotlib/fontList.cache backend Agg version v2.2 以上的訊息是我照 manual 上所指示所得到的訊息,下面是我測試的內容。 from pylab import * plot([1,2,3]) show() >>> from pylab import * >>> plot([1,2,3]) [<matplotlib.lines.Line2D object at 0x8bceeac>] >>> show() /usr/local/lib/python2.6/site-packages/matplotlib/backends/__init__.py:41: UserWarning: Your currently selected backend, 'Agg' does not support show(). Please select a GUI backend in your matplotlibrc file ('/root/.matplotlib/matplotlibrc') or with matplotlib.use() (backend, matplotlib.matplotlib_fname())) 由於問題出在 backend,看起來是指 Agg 不支援 show(),而搜尋相關網頁, 只找到一篇是使用 WXAgg(http://0rz.tw/WcgOw),於是我安裝了 wxPython, vi ~/.matplotlib/matplotlibrc,更改其內容為下 backend : WXAgg 可是更改之後,卻連 import 都不行了。 >>> from pylab import * Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.6/site-packages/pylab.py", line 1, in <module> from matplotlib.pylab import * File "/usr/local/lib/python2.6/site-packages/matplotlib/pylab.py", line 253, in <module> from matplotlib.pyplot import * File "/usr/local/lib/python2.6/site-packages/matplotlib/pyplot.py", line 75, in <module> new_figure_manager, draw_if_interactive, show = pylab_setup() File "/usr/local/lib/python2.6/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup globals(),locals(),[backend_name]) File "/usr/local/lib/python2.6/site-packages/matplotlib/backends/backend_wxagg.py", line 19, in <module> import wx ImportError: No module named wx 請問問題是出在哪裡呢?謝謝。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 163.25.118.144
yungyuc:matplotlib.use('TkAgg') 02/16 10:31