【问题标题】:Installing matplotlib inside a virtualenv using pip on a Mac在 Mac 上使用 pip 在 vi​​rtualenv 中安装 matplotlib
【发布时间】:2015-10-08 09:21:03
【问题描述】:

建议*为 python 安装 matplotlib 的命令是:

pip install -U git+git://github.com/matplotlib/matplotlib.git

在选择一个 virtualenv 然后运行该命令后,我收到了看似积极的结果,直到:

* The following required packages can not be built:

                        * freetype

然而,我的系统中到处都是freetypefreetype2 - 即使在 Anaconda 安装中也是如此。我尝试向我的$PATH 添加各种路径,例如:

/anaconda/include/freetype2/freetype
/anaconda/include/freetype2/
/anaconda/include/
//anaconda/include/freetype2/freetype

似乎没有任何效果,至少在致电which freetype 方面。

有没有其他方法可以显示我有 freetype 的系统?我只是在滥用$PATH吗?

*来自“Scipy Superpack for Homebrew”的建议


这是安装失败的全部输出:

Downloading/unpacking git+git://github.com/matplotlib/matplotlib.git
Cloning git://github.com/matplotlib/matplotlib.git to /var/folders/pl/9hfxwbf17knbpqpmdd4tq5j00000gn/T/pip-ZGwnWX-build
Running setup.py (path:/var/folders/pl/9hfxwbf17knbpqpmdd4tq5j00000gn/T/pip-ZGwnWX-build/setup.py) egg_info for package from git+git://github.com/matplotlib/matplotlib.git
============================================================================
Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
            matplotlib: yes [1.5.dev1]
                python: yes [2.7.6 (default, Sep  9 2014, 15:04:36)  [GCC
                        4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)]]
              platform: yes [darwin]

REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [version 1.9.0]
              dateutil: yes [using dateutil version 2.2]
                  pytz: yes [using pytz version 2014.7]
               tornado: yes [using tornado version 4.1]
             pyparsing: yes [using pyparsing version 2.0.3]
                libagg: yes [pkg-config information for 'libagg' could not
                        be found. Using local copy.]
              freetype: no  [The C/C++ header for freetype2 (ft2build.h)
                        could not be found.  You may need to install the
                        development package.]
                   png: yes [version 1.5.13]
                 qhull: yes [pkg-config information for 'qhull' could not be
                        found. Using local copy.]

OPTIONAL SUBPACKAGES
           sample_data: yes [installing]
              toolkits: yes [installing]
                 tests: yes [using nose version 1.3.4 / using mock 1.0.1]
        toolkits_tests: yes [using nose version 1.3.4 / using mock 1.0.1]

OPTIONAL BACKEND EXTENSIONS
                macosx: yes [installing, darwin]
                qt5agg: no  [PyQt5 not found]
                qt4agg: no  [PySide not found; PyQt4 not found]
               gtk3agg: no  [Requires pygobject to be installed.]
             gtk3cairo: no  [Requires cairocffi or pycairo to be installed.]
                gtkagg: no  [Requires pygtk]
                 tkagg: yes [installing, version 81008]
                 wxagg: no  [requires wxPython]
                   gtk: no  [Requires pygtk]
                   agg: yes [installing]
                 cairo: no  [cairocffi or pycairo not found]
             windowing: no  [Microsoft Windows only]

OPTIONAL LATEX DEPENDENCIES
                dvipng: no
           ghostscript: no
                 latex: no
               pdftops: no

============================================================================
                        * The following required packages can not be built:
                        * freetype

命令python setup.py egg_info的完整输出:

============================================================================

Edit `setup.cfg` to change the build options



BUILDING MATPLOTLIB

            matplotlib: yes [1.5.dev1]

                python: yes [2.7.6 (default, Sep  9 2014, 15:04:36)  [GCC

                        4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)]]

              platform: yes [darwin]



REQUIRED DEPENDENCIES AND EXTENSIONS

                 numpy: yes [version 1.9.0]

              dateutil: yes [using dateutil version 2.2]

                  pytz: yes [using pytz version 2014.7]

               tornado: yes [using tornado version 4.1]

             pyparsing: yes [using pyparsing version 2.0.3]

                libagg: yes [pkg-config information for 'libagg' could not

                        be found. Using local copy.]

              freetype: no  [The C/C++ header for freetype2 (ft2build.h)

                        could not be found.  You may need to install the

                        development package.]

                   png: yes [version 1.5.13]

                 qhull: yes [pkg-config information for 'qhull' could not be

                        found. Using local copy.]



OPTIONAL SUBPACKAGES

           sample_data: yes [installing]

              toolkits: yes [installing]

                 tests: yes [using nose version 1.3.4 / using mock 1.0.1]

        toolkits_tests: yes [using nose version 1.3.4 / using mock 1.0.1]



OPTIONAL BACKEND EXTENSIONS

                macosx: yes [installing, darwin]

                qt5agg: no  [PyQt5 not found]

                qt4agg: no  [PySide not found; PyQt4 not found]

               gtk3agg: no  [Requires pygobject to be installed.]

             gtk3cairo: no  [Requires cairocffi or pycairo to be installed.]

                gtkagg: no  [Requires pygtk]

                 tkagg: yes [installing, version 81008]

                 wxagg: no  [requires wxPython]

                   gtk: no  [Requires pygtk]

                   agg: yes [installing]

                 cairo: no  [cairocffi or pycairo not found]

             windowing: no  [Microsoft Windows only]



OPTIONAL LATEX DEPENDENCIES

                dvipng: no

           ghostscript: no

                 latex: no

               pdftops: no



============================================================================

                        * The following required packages can not be built:

                        * freetype

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /var/folders/pl/9hfxwbf17knbpqpmdd4tq5j00000gn/T/pip-ZGwnWX-build
Storing debug log for failure in /Users/rpanos/.pip/pip.log

【问题讨论】:

    标签: python matplotlib pip virtualenv freetype


    【解决方案1】:

    我有同样的问题。它对我有用的方式如下:

    sudo apt-get -y build-dep matplotlib  # then enter you root password
    virtualenv -p python2.7 ~/venv
    source ~/venv/bin/activate
    

    关键是安装系统范围matplotlib 依赖项的第一步。这个here的来源。

    【讨论】:

      【解决方案2】:

      也许这根本不是您想要的,但是您可以使用conda 来代替您的环境吗?例如。 conda create -n myenv anaconda?那已经有matplotlib了。您还可以准确自定义其中的内容。

      【讨论】:

      • 我很高兴在这一点上尝试任何事情!请让我研究一下,但感谢您的建议!
      猜你喜欢
      • 1970-01-01
      • 2018-05-15
      • 2013-01-19
      • 2016-05-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-16
      • 1970-01-01
      相关资源
      最近更新 更多