手机版
你好,游客 登录 注册
背景:
阅读新闻

pip 安装Matplotlib报错 png can not be built

[日期:2017-06-19] 来源:Linux社区  作者:sa14023053 [字体: ]

pip 安装Matplotlib的时候报如下错误

[root@biostacs /]# pip install matplotlib --upgrade
Collecting matplotlib
  Downloading matplotlib-1.5.1.tar.gz (54.0MB)
    100% |████████████████████████████████| 54.0MB 12kB/s
    Complete output from command Python setup.py egg_info:
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [1.5.1]
                    python: yes [2.7.5 (default, Nov 20 2015, 02:00:19)  [GCC
                            4.8.5 20150623 (Red Hat 4.8.5-4)]]
                  platform: yes [linux2]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.7.1]
                  dateutil: yes [using dateutil version 1.5]
                      pytz: yes [using pytz version 2012d]
                    cycler: yes [cycler was not found. pip will attempt to
                            install it after matplotlib.]
                   tornado: yes [using tornado version 4.2.1]
                 pyparsing: yes [Your pyparsing contains a bug that will be
                            monkey-patched by matplotlib.  For best results,
                            upgrade to pyparsing 2.0.1 or later.]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
                  freetype: yes [version 2.4.11]
                       png: no  [pkg-config information for 'libpng' could not
                            be found.]
                     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.0 / mock is required to
                            run the matplotlib test suite. Please install it
                            with pip or your preferred tool to run the test
                            suite]
            toolkits_tests: yes [using nose version 1.3.0 / mock is required to
                            run the matplotlib test suite. Please install it
                            with pip or your preferred tool to run the test
                            suite]

    OPTIONAL BACKEND EXTENSIONS
                    macosx: no  [Mac OS-X only]
                    qt5agg: no  [PyQt5 not found]
                    qt4agg: no  [PySide not found; PyQt4 not found]

    ** (-c:3688): WARNING **: Could not open X display
                   gtk3agg: yes [installing, version 3.13.14]

    ** (-c:3699): WARNING **: Could not open X display
                 gtk3cairo: yes [installing, version 3.13.14]
                    gtkagg: no  [pygtk present, but import failed.]
                     tkagg: no  [TKAgg requires Tkinter.]
                     wxagg: no  [requires wxPython]
                       gtk: no  [pygtk present, but import failed.]
                       agg: yes [installing]
                     cairo: yes [installing, pycairo version 1.8.10]
                 windowing: no  [Microsoft Windows only]

    OPTIONAL LATEX DEPENDENCIES
                    dvipng: yes [version 1.14]
               ghostscript: yes [version 9.07]
                     latex: yes [version 3.1415926]
                   pdftops: yes [version 0.26.5]

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

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

    ----------------------------------------

png无法建立 , 如果不知道这些库需要安装的包名,可以查一下:

[root@biostacs /]# yum search png | grep devel
libpng-devel.i686 : Development tools for programs to manipulate PNG image
libpng-devel.x86_64 : Development tools for programs to manipulate PNG image

安装libpng

 yum -y install libpng-devel

pip 安装matplotlib

[root@biostacs /]# pip install matplotlib --upgrade
You are using pip version 7.1.0, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting matplotlib
  Using cached matplotlib-1.5.1.tar.gz
Collecting numpy>=1.6 (from matplotlib)
  Downloading numpy-1.11.1.zip (4.7MB)
    100% |████████████████████████████████| 4.7MB 118kB/s
Collecting python-dateutil (from matplotlib)
  Downloading python_dateutil-2.5.3-py2.py3-none-any.whl (201kB)
    100% |████████████████████████████████| 204kB 1.4MB/s
Collecting pytz (from matplotlib)
  Downloading pytz-2016.6.1-py2.py3-none-any.whl (481kB)
    100% |████████████████████████████████| 483kB 912kB/s
Collecting cycler (from matplotlib)
  Downloading cycler-0.10.0-py2.py3-none-any.whl
Collecting pyparsing!=2.0.0,!=2.0.4,>=1.5.6 (from matplotlib)
  Downloading pyparsing-2.1.5-py2.py3-none-any.whl (42kB)
    100% |████████████████���███████████████| 45kB 1.1MB/s
Collecting six>=1.5 (from python-dateutil->matplotlib)
  Using cached six-1.10.0-py2.py3-none-any.whl
Building wheels for collected packages: matplotlib, numpy
  Running setup.py bdist_wheel for matplotlib
  Stored in directory: /root/.cache/pip/wheels/d8/38/3c/a388e11fd09f9b23f5e4cd74594197394d9fd65f91f64c4aa7
  Running setup.py bdist_wheel for numpy
  Stored in directory: /root/.cache/pip/wheels/10/1d/d8/608bdeaee5aad9e278259fa68d21a29c995a9117a250f7be26
Successfully built matplotlib numpy
Installing collected packages: numpy, six, python-dateutil, pytz, cycler, pyparsing, matplotlib
  Found existing installation: numpy 1.11.0
    Uninstalling numpy-1.11.0:
      Successfully uninstalled numpy-1.11.0
  Found existing installation: six 1.9.0
    Uninstalling six-1.9.0:
      Successfully uninstalled six-1.9.0
  Found existing installation: python-dateutil 1.5
    Uninstalling python-dateutil-1.5:
      Successfully uninstalled python-dateutil-1.5
  Found existing installation: pytz 2012d
    DEPRECATION: Uninstalling a distutils installed project (pytz) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling pytz-2012d:
      Successfully uninstalled pytz-2012d
  Found existing installation: pyparsing 1.5.6
    DEPRECATION: Uninstalling a distutils installed project (pyparsing) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling pyparsing-1.5.6:
      Successfully uninstalled pyparsing-1.5.6
  Found existing installation: matplotlib 1.2.0
    DEPRECATION: Uninstalling a distutils installed project (matplotlib) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling matplotlib-1.2.0:
      Successfully uninstalled matplotlib-1.2.0
Successfully installed cycler-0.10.0 matplotlib-1.5.1 numpy-1.11.1 pyparsing-2.1.5 python-dateutil-2.5.3 pytz-2016.6.1 six-1.10.0

成功了…

本文永久更新链接地址http://www.linuxidc.com/Linux/2017-06/144938.htm

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款