matplotlib 示例代码抛出 TclError [英] matplotlib example code throws TclError

查看:59
本文介绍了matplotlib 示例代码抛出 TclError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我尝试用 matplotlib 绘制任何东西时(fe 这个示例代码)我得到同样的错误:

Whenever I try to plot anything with matplotlib (f.e. this example code) I get the same error:

     jfm@ubuntu$  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"

我已经尝试修复了几个小时,但在interweb上找不到任何解决方案:(

I tried to fix this for several hours now but I don't find any solution on the interwebs :(

我刷新了python和matplotlib:

I refreshed python and matplotlib:

sudo apt-get install python2.7 

sudo apt-get install python-matplotlib

但错误消息保持不变:/

but the errormessage stays the same :/

我的设置:我在具有Python 2.7的64bit-Ububtu 14.04 VM上运行pythoncode.

My setup: I run the pythoncode on a 64bit-Ububtu 14.04 VM with Python 2.7.

推荐答案

我通过设置新的VM解决了该问题.我猜旧设备无法修复.

I solved the problem by setting up a new VM. I guess the old set up was beyond repair.

这篇关于matplotlib 示例代码抛出 TclError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆