2014-09-20 27 views
0

每當我嘗試繪圖與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。

+0

您可以複製您在此使用的代碼嗎?另外,你使用'thinter'還是隻使用'matplotlib'? – 2014-09-20 16:24:41

+1

@AleksanderLidtke:'matplotlib'有一個Tkinter後端。 – 2014-09-20 16:30:09

+0

該代碼是我鏈接的代碼:http://matplotlib.org/examples/animation/random_data.html。我嘗試運行的.py文件中沒有其他代碼或任何內容。所以我不明確使用thinter。 其他庫房(如numpy)的工作就像一個魅力。 – JFM 2014-09-20 16:31:05

回答

1

我通過設置新的VM解決了這個問題。我猜舊設置是無法修復的。

+0

,我該怎麼做? – moldovean 2014-10-31 07:35:02

+0

好的。我只是設置了一個新的虛擬機,並刪除了舊的虛擬機。這是我看到的最省時的方式。 – JFM 2014-11-01 18:06:13

+0

好的。我在opt目錄下編譯了一個python3的新副本(ubuntu) – moldovean 2014-11-03 18:41:54