导入 matplotlib.pyplot 不起作用

发布于 2024-11-18 14:13:03 字数 1298 浏览 2 评论 0原文

我是 python 新手,只是想设置一切。我尝试重新安装,但当我尝试“import matplotlib.pyplot as 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

谢谢!

I am new to python and just trying to set everything up. I've tried reinstalling but still keep getting an error when I try "import matplotlib.pyplot as plt", anyone know what this means?

 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

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏雨凉 2024-11-25 14:13:03

在多个 Mac 操作系统上安装 python 和 matplotlib 时,我遇到了类似的问题。我最终做的是使用 Python2.6 重新安装并获取兼容的包。我花了一些时间才弄清楚哪种组合适用于哪种架构,但最终我让一切都可以运行。

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

“OSX 上的构建情况因可以从(darwinports、fink、/usr/X11R6)获取 png 和 freetype 要求的各个地方以及不同的体系结构(x86、ppc、universal)而变得复杂。以及不同的 OSX 版本(10.4 和 10.5)。”

I've run into a similar problem when installing python and matplotlib on multiple Mac OSs. What I ended up doing was reinstalling with Python2.6 and also getting compatible packages. It took a little while to figure out which combination works with which architecture, but eventually I got everything to run.

The matplotlib website even mentions these issuse:

"The build situation on OSX is complicated by the various places one can get the png and freetype requirements from (darwinports, fink, /usr/X11R6) and the different architectures (x86, ppc, universal) and the different OSX version (10.4 and 10.5)."

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文