【发布时间】:2014-09-20 16:16:56
【问题描述】:
每当我尝试使用 matplotlib 绘制任何东西时(例如 this example code),我都会遇到同样的错误:
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"
我尝试了几个小时来解决这个问题,但我在互联网上没有找到任何解决方案:(
我刷新了python和matplotlib:
sudo apt-get install python2.7
和
sudo apt-get install python-matplotlib
但错误消息保持不变:/
我的设置:我使用 Python 2.7 在 64 位 Ububtu 14.04 VM 上运行 pythoncode。
【问题讨论】:
-
你能复制你在这里使用的代码吗?另外,您使用
thinter还是仅使用matplotlib? -
@AleksanderLidtke:
matplotlib有一个 Tkinter 后端。 -
代码是我链接的那个:matplotlib.org/examples/animation/random_data.html。我尝试运行的 .py 文件中没有其他代码或任何内容。所以我没有明确地使用thiner。其他库(如 numpy)就像一个魅力。
-
你能发布完整的回溯吗?
标签: python python-2.7 ubuntu matplotlib