在 ubuntu 14.04 上安装 python ggplot 失败

Installing of python ggplot fails on ubuntu 14.04

ggplot 安装失败,输出如下:

user@CompA:~$ sudo pip install -U ggplot
Downloading/unpacking ggplot
  Downloading ggplot-0.6.8.tar.gz (8.5MB): 8.5MB downloaded
  Running setup.py (path:/tmp/pip_build_root/ggplot/setup.py) egg_info for package ggplot

Downloading/unpacking six from https://pypi.python.org/packages/py2.py3/s/six/six-1.10.0-py2.py3-none-any.whl#md5=3ab558cf5d4f7a72611d59a81a315dc8 (from ggplot)
  Downloading six-1.10.0-py2.py3-none-any.whl
Downloading/unpacking statsmodels (from ggplot)
  Downloading statsmodels-0.6.1.tar.gz (7.0MB): 7.0MB downloaded
  Running setup.py (path:/tmp/pip_build_root/statsmodels/setup.py) egg_info for package statsmodels

    package init file 'statsmodels/tsa/vector_ar/data/__init__.py' not found (or not a regular file)
    warning: no files found matching '*.pxi' anywhere in distribution
    warning: no previously-included files matching '*' found under directory 'build'
    warning: no previously-included files matching '*' found under directory 'dist'
    warning: no previously-included files found matching 'docs/source/generated/*'
    warning: no previously-included files matching '*' found under directory 'docs/build'
    warning: no previously-included files matching '*' found under directory 'docs/build/htmlhelp'
    warning: no files found matching 'statsmodels/statsmodelsdoc.chm'
    no previously-included directories found matching '*/__pycache__'
    warning: no previously-included files matching '*~' found anywhere in distribution
    warning: no previously-included files matching '*.swp' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*.pyo' found anywhere in distribution
    warning: no previously-included files matching '*.bak' found anywhere in distribution
Downloading/unpacking brewer2mpl (from ggplot)
  Downloading brewer2mpl-1.4.1-py2.py3-none-any.whl
Downloading/unpacking matplotlib (from ggplot)
  Downloading matplotlib-1.5.0.tar.gz (54.0MB): 54.0MB downloaded
  Running setup.py (path:/tmp/pip_build_root/matplotlib/setup.py) egg_info for package matplotlib
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [1.5.0]
                    python: yes [2.7.6 (default, Jun 22 2015, 17:58:13)  [GCC
                            4.8.2]]
                  platform: yes [linux2]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.8.2]
                  dateutil: yes [dateutil was not found. It is required for date
                            axis support. pip/easy_install may attempt to
                            install it after matplotlib.]
                      pytz: yes [pytz was not found. pip will attempt to install
                            it after matplotlib.]
                    cycler: yes [cycler was not found. pip will attempt to
                            install it after matplotlib.]
                   tornado: yes [tornado was not found. It is required for the
                            WebAgg backend. pip/easy_install may attempt to
                            install it after matplotlib.]
                 pyparsing: yes [pyparsing was not found. It is required for
                            mathtext support. pip/easy_install may attempt to
                            install it after matplotlib.]
                    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.2.50]
                     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 [nose 0.11.1 or later is required to run the
                            matplotlib test suite. "setup.py test" will
                            automatically download it. Install nose 0.11.1 or
                            later to run matplotlib.test() / mock is required to
                            run the matplotlib test suite. "setup.py test" will
                            automatically download it. Install mock to run
                            matplotlib.test()]
            toolkits_tests: yes [nose 0.11.1 or later is required to run the
                            matplotlib test suite. "setup.py test" will
                            automatically download it. Install nose 0.11.1 or
                            later to run matplotlib.test() / mock is required to
                            run the matplotlib test suite. "setup.py test" will
                            automatically download it. Install mock to run
                            matplotlib.test()]

    OPTIONAL BACKEND EXTENSIONS
                    macosx: no  [Mac OS-X only]
                    qt5agg: no  [PyQt5 not found]
                    qt4agg: yes [installing, Qt: 4.8.6, PyQt: 4.8.6; PySide not
                            found]
                   gtk3agg: yes [installing, version 3.8.10]
                 gtk3cairo: yes [installing, version 3.8.10]
                    gtkagg: no  [The C/C++ header for gtk (gtk/gtk.h) could not
                            be found.  You may need to install the development
                            package.]
                     tkagg: no  [The C/C++ header for Tk (tk.h) could not be
                            found.  You may need to install the development
                            package.]
                     wxagg: no  [requires wxPython]
                       gtk: no  [The C/C++ header for gtk (gtk/gtk.h) could not
                            be found.  You may need to install the development
                            package.]
                       agg: yes [installing]
                     cairo: yes [installing, pycairo version 1.8.8]
                 windowing: no  [Microsoft Windows only]

    OPTIONAL LATEX DEPENDENCIES
                    dvipng: no
               ghostscript: yes [version 9.10]
                     latex: yes [version 3.1415926]
                   pdftops: yes [version 0.24.5]

    OPTIONAL PACKAGE DATA
                      dlls: no  [skipping due to configuration]

    ============================================================================
                            * The following required packages can not be built:
                            * freetype
    Complete output from command python setup.py egg_info:
    ============================================================================

Edit setup.cfg to change the build options



BUILDING MATPLOTLIB

            matplotlib: yes [1.5.0]

                python: yes [2.7.6 (default, Jun 22 2015, 17:58:13)  [GCC

                        4.8.2]]

              platform: yes [linux2]



REQUIRED DEPENDENCIES AND EXTENSIONS

                 numpy: yes [version 1.8.2]

              dateutil: yes [dateutil was not found. It is required for date

                        axis support. pip/easy_install may attempt to

                        install it after matplotlib.]

                  pytz: yes [pytz was not found. pip will attempt to install

                        it after matplotlib.]

                cycler: yes [cycler was not found. pip will attempt to

                        install it after matplotlib.]

               tornado: yes [tornado was not found. It is required for the

                        WebAgg backend. pip/easy_install may attempt to

                        install it after matplotlib.]

             pyparsing: yes [pyparsing was not found. It is required for

                        mathtext support. pip/easy_install may attempt to

                        install it after matplotlib.]

                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.2.50]

                 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 [nose 0.11.1 or later is required to run the

                        matplotlib test suite. "setup.py test" will

                        automatically download it. Install nose 0.11.1 or

                        later to run matplotlib.test() / mock is required to

                        run the matplotlib test suite. "setup.py test" will

                        automatically download it. Install mock to run

                        matplotlib.test()]

        toolkits_tests: yes [nose 0.11.1 or later is required to run the

                        matplotlib test suite. "setup.py test" will

                        automatically download it. Install nose 0.11.1 or

                        later to run matplotlib.test() / mock is required to

                        run the matplotlib test suite. "setup.py test" will

                        automatically download it. Install mock to run

                        matplotlib.test()]



OPTIONAL BACKEND EXTENSIONS

                macosx: no  [Mac OS-X only]

                qt5agg: no  [PyQt5 not found]

                qt4agg: yes [installing, Qt: 4.8.6, PyQt: 4.8.6; PySide not

                        found]

               gtk3agg: yes [installing, version 3.8.10]

             gtk3cairo: yes [installing, version 3.8.10]

                gtkagg: no  [The C/C++ header for gtk (gtk/gtk.h) could not

                        be found.  You may need to install the development

                        package.]

                 tkagg: no  [The C/C++ header for Tk (tk.h) could not be

                        found.  You may need to install the development

                        package.]

                 wxagg: no  [requires wxPython]

                   gtk: no  [The C/C++ header for gtk (gtk/gtk.h) could not

                        be found.  You may need to install the development

                        package.]

                   agg: yes [installing]

                 cairo: yes [installing, pycairo version 1.8.8]

             windowing: no  [Microsoft Windows only]



OPTIONAL LATEX DEPENDENCIES

                dvipng: no

           ghostscript: yes [version 9.10]

                 latex: yes [version 3.1415926]

               pdftops: yes [version 0.24.5]



OPTIONAL PACKAGE DATA

                  dlls: no  [skipping due to configuration]



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

                        * The following required packages can not be built:

                        * freetype

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/matplotlib
Storing debug log for failure in /home/user/.pip/pip.log
user@CompA:~$ 

我使用的命令是:

sudo pip install -U ggplot

我已经尝试安装 python-dev 包并升级 pip:

sudo apt-get install python-pip 
sudo apt-get install python-dev

我是 运行 Ubuntu 14.04 和 Python 2.7.10 Anaconda 2.3.0(64 位)

阅读日志:

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

所以,试试这个命令:

sudo apt-get install libfreetype6-dev libxft-dev