2014-09-20 85 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