3

我在 python 命令提示符下输入这个错误:import matplotlib.pyplot as plt

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    import matplotlib.pyplot as plt
  File "/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/pyplot.py", line 97, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/backends/__init__.py", line 25, in pylab_setup
    globals(),locals(),[backend_name])
  File "/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/backends/backend_macosx.py", line 21, in <module>
    from matplotlib.backends import _macosx
ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/backends/_macosx.so, 2): Library not loaded: /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText
  Referenced from: /Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/backends/_macosx.so
  Reason: image not found

有人可以建议我,我该如何解决这个问题?我已经用这个 shell 脚本安装了所有的包

https://github.com/fonnesbeck/ScipySuperpack

有什么我想念的吗?有什么额外的配置吗?

4

2 回答 2

2

我支持 OSX 10.7.4 的 andershqst:

转到此目录:

cd /System/Library/Frameworks

验证此路径是否存在:

ls /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreText.framework/Versions/A/CoreText

创建此软链接:

sudo ln -s /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreText.framework Coretext.framework

然后按照本教程中的说明测试您的修复。

于 2013-03-30T02:54:50.290 回答
0

我在使用 ScipySuperpack 时遇到了同样的问题,并通过以下方式解决了它。

打开终端并找到 CoreText.framework 文件的路径

sudo find / -name "CoreText.framework"

从定位路径的 CoreText 文件到 ImportError 中的路径创建一个符号链接

sudo ln -s path_located path_where_it_is_missing

此时我遇到了另一个构建错误,因为我运行的是 OSX 10.7.5(10.8 是您当前从 ScipySuperpack 页面获得的那个)在这种情况下,从这里获取 ScipySuperpack并在提示“你在安装吗”时回答“是”从克隆到这台机器的存储库(如果不确定,请回答否)?(是/否)'

于 2012-11-24T16:13:11.547 回答