导入matplotlib.pyplot,因为plt失败,出现关于python tk的错误

导入matplotlib.pyplot,因为plt失败,出现关于python tk的错误,python,numpy,matplotlib,Python,Numpy,Matplotlib,我尝试导入matplotlib.pyplot,但收到一个与未安装python tk相关的错误。它似乎已安装,但我似乎仍然收到错误。任何帮助都将受到感谢。有关更多信息,请参见下面的输出。非常感谢 $ ipython Python 2.7.7 (default, Jun 3 2014, 16:16:56) Type "copyright", "credits" or "license" for more information. IPython 2.1.0 --

我尝试导入matplotlib.pyplot,但收到一个与未安装python tk相关的错误。它似乎已安装,但我似乎仍然收到错误。任何帮助都将受到感谢。有关更多信息,请参见下面的输出。非常感谢

    $ ipython
    Python 2.7.7 (default, Jun  3 2014, 16:16:56)
    Type "copyright", "credits" or "license" for more information.

    IPython 2.1.0 -- An enhanced Interactive Python.
    ?         -> Introduction and overview of IPython's features.
    %quickref -> Quick reference.
    help      -> Python's own help system.
    object?   -> Details about 'object', use 'object??' for extra details.

    In [1]: import numpy as np

    In [2]: import matplotlib.pyplot as plt
    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    <ipython-input-2-eff513f636fd> in <module>()
    ----> 1 import matplotlib.pyplot as plt

    /usr/lib/pymodules/python2.7/matplotlib/pyplot.py in <module>()
         96
         97 from matplotlib.backends import pylab_setup
    ---> 98 _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
         99
        100

    /usr/lib/pymodules/python2.7/matplotlib/backends/__init__.pyc in pylab_setup()
         26     # imports. 0 means only perform absolute imports.
         27     backend_mod = __import__(backend_name,
    ---> 28                              globals(),locals(),[backend_name],0)
         29
         30     # Things we pull in from all backends

    /usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py in <module>()
          6 import os.path
          7
    ----> 8 import Tkinter as Tk, FileDialog
          9
         10 # Paint image to Tk photo blitter extension

    /usr/lib/python2.7/lib-tk/Tkinter.py in <module>()
         40     import _tkinter
         41 except ImportError, msg:
    ---> 42     raise ImportError, str(msg) + ', please install the python-tk package'
         43 tkinter = _tkinter # b/w compat for export
         44 TclError = _tkinter.TclError

    ImportError: libBLT.2.4.so.8.5: cannot open shared object file: No such file or directory, please install the python-tk package
$ipython
Python 2.7.7(默认值,2014年6月3日,16:16:56)
有关详细信息,请键入“版权”、“信用”或“许可证”。
iPython2.1.0——一种增强的交互式Python。
?         -> 介绍和概述IPython的功能。
%快速参考->快速参考。
帮助->Python自己的帮助系统。
对象?->有关“对象”的详细信息,请使用“对象??”获取更多详细信息。
在[1]中:将numpy作为np导入
在[2]中:将matplotlib.pyplot作为plt导入
---------------------------------------------------------------------------
ImportError回溯(最近一次呼叫最后一次)
在()
---->1将matplotlib.pyplot作为plt导入
/usr/lib/pymodules/python2.7/matplotlib/pyplot.py in()
96
97从matplotlib.backends导入pylab_设置
--->98(后端)(mod),新(图形)管理器(manager),如果互动(draw),(show=pylab)设置
99
100
/pylab_setup()中的usr/lib/pymodules/python2.7/matplotlib/backends/__init__;.pyc
26.进口。0表示仅执行绝对导入。
27后端模块=uuuu导入(后端名称,
--->28全局变量(),局部变量(),[backend_name],0)
29
30#我们从所有后端获取的东西
/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py in()
6导入操作系统路径
7.
---->8将Tkinter作为Tk导入,文件对话框
9
10#将图像绘制到Tk照片光点扩展
/usr/lib/python2.7/lib-tk/Tkinter.py in()
40进口
41除此之外,msg:
--->42.str(msg)+',请安装python tk包'
43 tkinter=#t kinter#b/w出口兼容
44 TclError=\u tkinter.TclError
ImportError:libBLT.2.4.so.8.5:无法打开共享对象文件:没有此类文件或目录,请安装python tk包
没有这样的文件或目录,请安装python tk包

使用以下方法安装软件包:

sudo apt-get install python-tk
请参阅debian bugreport:
(据我所知,matplotlib不依赖于“blt”)

作为临时安排

mv libBLT.2.4.so.8.6 libBLT.2.4.so.8.5

在/usr/lib/下。它应该又能正常工作了

谢谢你的回复。它似乎已安装。仔细检查并获得:apt get install python tk阅读包列表。。。已完成构建依赖关系树以读取状态信息。。。Done python tk已经是最新版本了。0已升级,0已新安装,0已删除,1未升级。您使用的是什么发行版?在usr/lib中是否有
libBLT.2.4.so.8.5
?尝试
sudo-apt-get-install-blt
sudo-apt-get-build-dep-matplotlibblt似乎已安装,并且库在那里:$ls/usr/lib/| grep-libBLT-libBLT.2.4.so.8.6-libBLTlite.2.4.so.8.6尝试安装依赖项,但没有效果。使用Linux机器3.14-1-amd64#1 SMP Debian 3.14.4-1(2014-05-13)x86_64 GNU/Linux$谢谢,尝试一下,但运气不太好()。我已经发现了,所以我现在正在研究这个问题。考虑到这个答案至少帮助了一个用户,最好添加一个解释。