1

我在运行雪豹的 Mac 上编译了 matplotlib,却发现当我导入 matplotlib.pyplot 时出现以下错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/pyplot.py", line 6, in <module>
    from matplotlib.figure import Figure, figaspect
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py", line 18, in <module>
    from axes import Axes, SubplotBase, subplot_class_factory
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axes.py", line 12, in <module>
    import matplotlib.axis as maxis
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py", line 10, in <module>
    import matplotlib.font_manager as font_manager
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py", line 52, in <module>
    from matplotlib import ft2font
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/ft2font.so, 2): Symbol not found: _FT_Attach_File
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/ft2font.so
  Expected in: dynamic lookup

我该如何解决?

4

1 回答 1

0

在 OS X 上构建 matplotlib 是出了名的充满了链接到系统目录中不匹配的库版本的问题,/usr/local,/opt/local,你有什么。这就是为什么在源代码分发中有一个 README.osx 文件建议您使用分发中提供的 make.osx 文件来获取和编译库并针对获取的副本构建 matplotlib。

于 2010-09-23T16:39:43.427 回答