代码之家  ›  专栏  ›  技术社区  ›  Lin Ma

Windows 7上针对freetype、png包的Python matplotlib安装问题

  •  19
  • Lin Ma  · 技术社区  · 9 年前

    在Windows 7上使用Python 2.7。下面是我用来安装的命令和错误消息。想知道是否有人以前遇到过类似的问题?谢谢

    C:\Python27\Scripts>pip install matplotlib
    Collecting matplotlib
      Downloading matplotlib-1.5.2.tar.gz (51.6MB)
        100% |################################| 51.6MB 19kB/s
        Complete output from command python setup.py egg_info:
        ============================================================================
    
        Edit setup.cfg to change the build options
    
        BUILDING MATPLOTLIB
                    matplotlib: yes [1.5.2]
                        python: yes [2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015,
                                20:40:30) [MSC v.1500 64 bit (AMD64)]]
                      platform: yes [win32]
    
        REQUIRED DEPENDENCIES AND EXTENSIONS
                         numpy: yes [version 1.11.1]
                      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 freetype (ft2build.h)
                                could not be found.  You may need to install the
                                development package.]
                           png: no  [The C/C++ header for png (png.h) could not be
                                found.  You may need to install the development
                                package.]
                         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. Please install it with pip or
    
                                your preferred tool to run the test suite / 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 [nose 0.11.1 or later is required to run the
                                matplotlib test suite. Please install it with pip or
    
                                your preferred tool to run the test suite / 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]
                       gtk3agg: no  [Requires pygobject to be installed.]
                     gtk3cairo: no  [Requires cairocffi or pycairo to be installed.]
    
                        gtkagg: no  [Requires pygtk]
                         tkagg: yes [installing; run-time loading from Python Tcl /
                                Tk]
                         wxagg: no  [requires wxPython]
                           gtk: no  [Requires pygtk]
                           agg: yes [installing]
                         cairo: no  [cairocffi or pycairo not found]
                     windowing: yes [installing]
    
        OPTIONAL LATEX DEPENDENCIES
                        dvipng: no
                   ghostscript: no
                         latex: no
                       pdftops: no
    
        OPTIONAL PACKAGE DATA
                          dlls: no  [skipping due to configuration]
    
        ============================================================================
    
                                * The following required packages can not be built:
                                * freetype, png
    
        ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in c:\users\foo\a
    ppdata\local\temp\pip-build-zxfsow\matplotlib\
    
    8 回复  |  直到 9 年前
        1
  •  14
  •   Ryan B.    9 年前

    png freetype 缺少模块。您需要单独安装它们。

    尝试执行以下操作:

    > pip install freetype-py
    > pip install pypng
    > pip install matplotlib
    
        2
  •  12
  •   Doron Gombosh    9 年前

    我采用1.5.1版解决了这个问题

    pip install matplotlib==1.5.1
    

        3
  •  7
  •   Community Mohan Dere    9 年前

    http://www.lfd.uci.edu/~gohlke/pythonlibs/

    从上面的位置获取matplotlib。根据python(2.x/3.x)和bit(32/64)版本选择正确的包。

    32-bit 2.7: matplotlib-1.5.2-cp27-cp27m-win32.whl
    64-bit 2.7: matplotlib-1.5.2-cp27-cp27m-win_amd64.whl
    

    如果您在中间遇到任何问题,请参阅以下链接: https://stackoverflow.com/a/38618044/5334188

        4
  •  4
  •   E.Mich    9 年前

    我也有同样的问题。

    似乎我的pip是旧的v7。 然后再次尝试安装matplotlib,这次成功了。

    也许这有帮助

        5
  •  2
  •   Mark    9 年前

    我和你遇到了同样的问题,这是我的解决方案

    它存在与最新pip集成的python 3.6的问题。 所以我用pip安装了python 3.5.2,但不升级pip。 您可以通过这种方式安装matplotlib。

    希望我能提供一个可能的解决方案

        6
  •  1
  •   Süleyman Efendi    8 年前

    我在W°ndows 10中解决了相同的问题,如下所示:

    matplotlib-2.2.2-cp27-cp37m-win32.whl
    

    matplotlib-2.2.2-cp27-cp37m-win_amd64.whl
    

    来自 https://www.lfd.uci.edu/~gohlke/pythonlibs/

    .\Downloads> python -m pip install matplotlib-2.2.2-cp37-cp37m-win_amd64.whl
    

    你可以试试matplolib

        7
  •  1
  •   Matt Cremeens    6 年前

    我今天遇到了这个问题 Python 3.8.0 安装成功 matplotlib==3.2.0rc1 安装后 freetype-py .

        8
  •  0
  •   Cribber    6 年前

    在Windows 10上安装特定的matplotlib 2.2.5版对我很管用。

    pip install matplotlib==2.2.5