我是 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
谢谢!
最佳答案
在多个 Mac 操作系统上安装 python 和 matplotlib 时,我遇到了类似的问题。我最终做的是重新安装 Python2.6 并获得兼容的包。花了一些时间来弄清楚哪种组合适用于哪种架构,但最终我让一切都可以运行。
matplotlib 网站甚至提到了这些问题:
“由于可以从(darwinports、fink、/usr/X11R6)和不同的体系结构(x86、ppc、universal)和不同的 OSX 版本(10.4 和10.5)”。
关于macos - 导入 matplotlib.pyplot 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6594774/