0

ディスプレイはモジュールです:

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

これが何を意味するか分かる人いますか?!

4

1 に答える 1

0

OS X でこれを実行しているようです。別の OS X ユーザーが同じエラーを起こしたこの質問を見てください。matplotlib のインストールが破損している可能性があります。OS X に matplotlib をインストールする方法を詳しく説明しているこのページにリンクされている問題のマークされた回答。

于 2012-12-11T20:25:52.313 に答える