Python 此(matplotlib)错误消息是什么意思?

Python 此(matplotlib)错误消息是什么意思?,python,numpy,matplotlib,Python,Numpy,Matplotlib,显示模块: import matplotlib matplotlib.use('TkAgg') #TkAgg is quite slow but should work on all platforms. import time import numpy import matplotlib.pyplot as plt def display_2d_array(arr): '''Display a square 2D numpy array as a greyscale ima

显示模块:

import matplotlib
matplotlib.use('TkAgg')   #TkAgg is quite slow but should work on all platforms.

import time
import numpy
import matplotlib.pyplot as plt  

def display_2d_array(arr):
    '''Display a square 2D numpy array as a greyscale image.'''
    assert len(arr.shape) == 2 and arr.shape[0] == arr.shape[1]
    plt.ion()
    plt.clf()
    plt.imshow(arr,origin="lower",extent=[0,arr.shape[0],0,arr.shape[0]])
   plt.gray()
   plt.draw()
   raw_input('Hit enter to continue.')
但当我在模块中调用它时,我得到:

File "/Users/tomkimpson/display.py", line 8, in <module>
import matplotlib.pyplot as plt  
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site                  packages/matplotlib/pyplot.py", line 26, in <module>
from matplotlib.figure import Figure, figaspect
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-  packages/matplotlib/figure.py", line 24, in <module>
import matplotlib.artist as martist
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.py", line 7, in <module>
from transforms import Bbox, IdentityTransform, TransformedBbox, \
 File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/transforms.py", line 35, in <module>
from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-  packages/matplotlib/_path.so, 2): no suitable image found.  Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-   packages/matplotlib/_path.so: no matching architecture in universal wrapper
文件“/Users/tomkimpson/display.py”,第8行,在
将matplotlib.pyplot作为plt导入
文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site packages/matplotlib/pyplot.py”,第26行,在
从matplotlib.figure导入FigSpect图形
文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/figure.py”,中的第24行
将matplotlib.artist作为martist导入
文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site packages/matplotlib/artist.py”,第7行,在
从transforms导入Bbox、IdentityTransform、TransformedBbox、\
文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site packages/matplotlib/transforms.py”,第35行,在
从matplotlib.\u路径导入(仿射变换、计数\u盒\u重叠\u盒,
ImportError:dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_path.so,2):未找到合适的映像。确实找到:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_path.so:通用包装器中没有匹配的体系结构

有人知道这意味着什么吗?!

看起来你在OS X上运行这个。看看这个,另一个OS X用户也有同样的错误。你的matplotlib安装可能已损坏。问题中的标记答案链接到,其中详细说明了如何在OS X上安装matplotlib。

该功能似乎根本不相关。t错误发生在上次导入时。您可以删除该问题以删除不相关的代码,还可以提供更详细的标题。matplotlib安装可能有问题。您以前是否成功使用过matplotlib,或者此错误只是随机出现的?您可以尝试重新安装matplotlib。好的,谢谢我将尝试重新安装。以前从未使用过matplotlib。完成编程noob!FWIW--我最近使用
pip
在OS-X 10.5.8上成功安装了matplotlib。