【问题标题】:Installing matplotlib on Mac OSX Mountain Lion在 Mac OSX Mountain Lion 上安装 matplotlib
【发布时间】:2012-08-31 19:31:08
【问题描述】:

我正在尝试安装 matplotlib,但遇到了很多问题。我从 pip install matplotlib 以及尝试从源代码构建都收到一个常见错误:

BUILDING MATPLOTLIB

        matplotlib: 1.1.1

            python: 2.7.2 (default, Jun 20 2012, 16:23:33)  [GCC 4.2.1

                    Compatible Apple Clang 4.0

                    (tags/Apple/clang-418.0.60)]

          platform: darwin

所需的依赖项

             numpy: 1.6.1

                    * Could not find the headers for numpy.  You may

                    * need to install the development package.

编辑:终于解决了。我需要安装 gfortran 和 gcc 编译器。是用 brew 做的吗,一切都像魅力一样!

【问题讨论】:

  • 从源代码构建应该没问题(至少使用 git 的最新版本)。但是你需要确保 numpy 的头文件在链接器路径中。

标签: python macos matplotlib


【解决方案1】:

在 Mountain Lion 上安装 matplotlib 需要安装 matplotlib 的开发版本。

试试pip install git+https://github.com/matplotlib/matplotlib.git#egg=matplotlib-dev

您可能需要numpy 1.6.2 才能使用它。

一般来说,对于 Mountain Lion,您可以在 this link 找到很好的建议和详细描述的安装 numpy/scipy/matplotlib/IPhython 的分步过程

【讨论】:

  • 您可能希望将其固定到适用于 mac 的最新标签:git+git://github.com/matplotlib/matplotlib.git@v1.1.1@egg=matplotlib
【解决方案2】:

终于解决了。我需要安装 gfortran 和 gcc 编译器。是用 brew 做的吗,一切都像魅力一样!

【讨论】:

  • 你是如何安装 gcc 和 fortran 的?我在 brew 中找到了 gfortran,但没有找到 gcc?另外,你是之后直接安装matplotlib还是必须pip install --upgrade numpyfirst?
  • @kermit666 它在 brew 中
  • 谢谢,@彼得。不过可能晚了一年 :) 这是对我有用的教程:thisisthegreenroom.com/2011/…
【解决方案3】:

macports 或 brew 是在 mac 上处理此类事情的最佳方式。我的经验

【讨论】:

    【解决方案4】:

    安装 numpy.

    pip install numpy
    

    它应该为您解决依赖关系 - 我不确定它为什么不起作用。

    【讨论】:

    • 我已经有 numpy 了。无论如何,我又试了一次,它说满足要求。刚刚尝试过 numpy
    • 你安装了 numpy-dev 包吗?
    猜你喜欢
    • 2013-04-13
    • 2013-09-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-22
    • 1970-01-01
    • 2012-12-26
    • 1970-01-01
    相关资源
    最近更新 更多