5

我是 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

谢谢!

4

1 回答 1

1

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

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

“OSX 上的构建情况由于可以从(darwinports、fink、/usr/X11R6)和不同架构(x86、ppc、universal)和不同 OSX 版本(10.4 和10.5)。”

于 2011-09-14T17:55:57.217 回答