【问题标题】:Can't build matplotlib from source on Windows 64 (Py3.6) - png error无法在 Windows 64(Py3.6)上从源代码构建 matplotlib - png 错误
【发布时间】:2018-03-05 07:34:27
【问题描述】:

从网上的大量研究来看,在 Windows 上从源代码安装 matplotlib 似乎并不简单,而且很多都有问题。虽然许多 SO 帖子已经解决了问题,但我仍然遇到一个我似乎无法解决的问题。

从 GitHub 克隆 matplotlib 存储库后,我按照 matplotlib 网站的说明进行安装,并在尝试运行 python setup.py develop 时得到以下输出日志:

============================================================================
Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
            matplotlib: yes [2.0.2+4901.g7dc7a325c]
                python: yes [3.6.2 |Continuum Analytics, Inc.| (default, Jul
                        20 2017, 12:30:02) [MSC v.1900 64 bit (AMD64)]]
              platform: yes [win32]

REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [version 1.13.1]
                   six: yes [using six version 1.10.0]
              dateutil: yes [dateutil was not found. It is required for date
                        axis support. pip/easy_install may attempt to
                        install it after matplotlib.]
backports.functools_lru_cache: yes [Not required]
          subprocess32: yes [Not required]
                  pytz: yes [pytz was not found. pip/easy_install may
                        attempt to install it after matplotlib.]
                cycler: yes [cycler was not found. pip/easy_install may
                        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: yes [Using local version for testing]
                   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 'libqhull' could not
                        be found. Using local copy.]

OPTIONAL SUBPACKAGES
           sample_data: yes [installing]
              toolkits: yes [installing]
                 tests: no  [skipping due to configuration]
        toolkits_tests: no  [skipping due to configuration]

OPTIONAL BACKEND EXTENSIONS
                macosx: no  [Mac OS-X only]
                qt5agg: no  [PySide2 not found; 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: yes [version 1.15]
           ghostscript: yes [version 9.20]
                 latex: yes [version MiKTeX 2.9]
               pdftops: yes [version 0.55.0]

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

============================================================================
                        * The following required packages can not be built:
                        * png * Please check http://gnuwin32.sourceforge.net
                        * /packages/libpng.htm for instructions to install
                        * png

问题似乎是 libpng。

我尝试使用推荐的适用于 Windows 的 scipt (https://github.com/jbmohler/matplotlib-winbuild),但出现 VS2010 not found 错误。当我尝试安装它时,Microsoft Python Tools 网站提示 Py3.6 64-bit 不支持早于 VS2015 的版本。

我还尝试使用来自 http://gnuwin32.sourceforge.net/packages/libpng.htm 的二进制文件手动安装 libpng 但即使安装成功,我也会遇到同样的错误。

请问有解决办法吗?或者对于如何为 Windows 安装 matplotlib 有什么很好的参考 - 似乎这里的权威和全面的指南对社区非常有用,因为用户有很多问题在这方面苦苦挣扎!

任何帮助欢迎感谢!

【问题讨论】:

    标签: python python-3.x visual-studio-2010 matplotlib build


    【解决方案1】:

    我设法使用 these instructions 从 Visual Studio 2017 的源代码构建 matplotlib 3.1.1。

    其中一个技巧是某些库需要重命名,例如 libpng.lib -> png.libzlib.lib -> z.lib

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-06
      • 1970-01-01
      • 1970-01-01
      • 2015-03-02
      • 1970-01-01
      • 2014-07-16
      • 2023-03-25
      • 2021-01-01
      相关资源
      最近更新 更多