每當我嘗試繪圖與matplotlib任何東西(FE this example code)我得到了同樣的錯誤:matplotlib示例代碼拋出TclError
[email protected]$ python test_for_matplotlib.py
Traceback (most recent call last):
File "test_for_matplotlib.py", line 5, in <module>
fig, ax = plt.subplots()
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 1046, in subplots
fig = figure(**fig_kw)
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 423, in figure
**kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 79, in new_figure_manager
return new_figure_manager_given_figure(num, figure)
File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 87, in new_figure_manager_given_figure
window = Tk.Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1767, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: unknown color name "S_base3"
我想現在就解決這個問題了幾個小時,但我沒有找到任何解決方案在interwebs :(
我刷新Python和matplotlib:
sudo apt-get install python2.7
和
sudo apt-get install python-matplotlib
但errormessage的保持不變:/
我的設置:我運行在64位,Ububtu 14.04 VM的Python代碼與Python 2.7。
您可以複製您在此使用的代碼嗎?另外,你使用'thinter'還是隻使用'matplotlib'? – 2014-09-20 16:24:41
@AleksanderLidtke:'matplotlib'有一個Tkinter後端。 – 2014-09-20 16:30:09
該代碼是我鏈接的代碼:http://matplotlib.org/examples/animation/random_data.html。我嘗試運行的.py文件中沒有其他代碼或任何內容。所以我不明確使用thinter。 其他庫房(如numpy)的工作就像一個魅力。 – JFM 2014-09-20 16:31:05