导入matplotlib.pyplot不起作用

时间:2011-07-06 10:14:40

标签: macos matplotlib importerror

我是python的新手,只是试图设置一切。我尝试重新安装但在我尝试“导入matplotlib.pyplot作为plt”时仍然出现错误,任何人都知道这意味着什么?

 Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    import matplotlib.pyplot as plt
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/pyplot.py", line 23, 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 16, in <module>
import artist
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.py", line 6, in <module>
from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/transforms.py", line 34, in <module>
from matplotlib._path import affine_transform
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

谢谢!

1 个答案:

答案 0 :(得分:1)

在多个Mac OS上安装python和matplotlib时遇到了类似的问题。我最终做的是重新安装Python2.6并获得兼容的软件包。花了一点时间才弄清楚哪种组合适用于哪种架构,但最终我得到了一切。

matplotlib网站甚至提到了这些问题:

“OSX上的构建情况很复杂,可以从(darwinports,fink,/ usr / X11R6)和不同体系结构(x86,ppc,通用)和不同OSX版本获得png和freetype要求的各个地方(10.4和10.5)。“