【问题标题】:Failed "import matplotlib.pylab" due to /backends/_macosx.so Reason: image not found由于 /backends/_macosx.so 导致“导入 matplotlib.pylab”失败原因:找不到图像
【发布时间】:2012-09-13 03:25:08
【问题描述】:

系统和软件版本:

  • OSX 10.7.4
  • matplotlib 1.1.1,用于 Python 2.7 和 OSX 10.6,通过 .mpkg 安装。
  • Python 2.7.3,通过 .mpkg 安装。

    import matplotlib.pylabTraceback(最近一次调用最后): 文件“”,第 1 行,在 文件“/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7.egg/matplotlib/pylab.py”,第 265 行,在 从 matplotlib.pyplot 导入 * 文件“/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7.egg/matplotlib/pyplot.py”,第 97 行,在 new_figure_manager, draw_if_interactive, _show = pylab_setup() pylab_setup 中的文件“/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7.egg/matplotlib/backends/init.py”,第 25 行 globals(),locals(),[backend_name]) 文件“/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7.egg/matplotlib/backends/backend_macosx.py”,第 21 行,在 从 matplotlib.backends 导入 _macosx ImportError:dlopen(/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7.egg/matplotlib/backends/_macosx.so,2):未加载库:/System/Library/Frameworks/CoreText .framework/版本/A/CoreText 引用自:/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7.egg/matplotlib/backends/_macosx.so 原因:找不到图片

【问题讨论】:

    标签: python osx-snow-leopard matplotlib


    【解决方案1】:

    您是否安装了 numpy 版本 1.4 或更高版本?其他先决条件可以找到http://matplotlib.org/users/installing.html

    当我缺少依赖项时,我收到了类似的模棱两可的消息。

    【讨论】:

      【解决方案2】:

      我自己安装 MatplotLib 包时遇到了一些麻烦。在这里查看我的答案我是如何解决的:

      How to check whether I have IPython installed on my machine and what sequence to install these libraries?

      【讨论】:

        【解决方案3】:

        另见:

        http://www.zqna.net/qna/knuzvt-i-am-getting-this-error-on-using-matplotlib.html

        我的解决方案:

        我有 OS X 10.7.5,运行 python 2.7.1,numpy-1.8.0.dev_4600b2f_20130131-py2.7-macosx-10.8-intel.egg,scipy-0.12.0.dev_b69fe18_20130131-py2.7-macosx -10.8-intel.egg

        之前我得到了你上面列出的错误,matplotlib 1.3 无法找到 CoreText.framework,但是当我恢复到 matplotlib 1.2 时,错误消失了,我能够很好地运行它 - 我刚刚编辑了easy_install.pth 文件(不确定这是否是解决问题的正确方法,但我不需要创建符号链接,因为旧的 1.2 版本工作得很好)

        简单的安装是 2013 年 2 月 8 日从 fonnesbeck scipy superpack 重新安装的,自去年秋天以来,我一直试图让所有东西都焕然一新。

        【讨论】:

          【解决方案4】:

          这对我有用:

          brew install pkg-config
          brew link pkg-config
          brew install pygtk
          brew install freetype
          brew install libpng
          
          sudo ln -s /usr/local/Cellar/freetype/*/lib/pkgconfig/freetype2.pc /usr/local/lib/pkgconfig/freetype2.pc
          
          git clone git@github.com:matplotlib/matplotlib.git
          cd matplotlib
          python setup.py build
          python setup.py install
          

          参考资料:

          http://blog.caoyuan.me/2012/08/matplotlib-error-mac-os-x/ http://matplotlib.org/faq/installing_faq.html#install-from-git http://www.tapir.caltech.edu/~dtsang/python.html

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2018-09-11
            • 2023-03-03
            • 2019-11-21
            • 1970-01-01
            • 2020-11-26
            • 2018-08-04
            • 2018-09-14
            • 1970-01-01
            相关资源
            最近更新 更多