简体   繁体   English

Python 安装旧版本的 matplotlib 导致 freetype 和 png 错误

[英]Python installing old version of matplotlib results in freetype and png error

I am attempting to install the following package: https://pypi.org/project/autocluster/我正在尝试安装以下 package: https://pypi.org/project/autocluster/

However, it looks like it requires the use of matplotlib==3.0.3, as when I try to install it i get the following error:但是,它看起来需要使用 matplotlib==3.0.3,因为当我尝试安装它时出现以下错误:

I already have newer versions of matplotlib installed and I also tried installing older versions, but its heart is set on building new package with 3.0.3.我已经安装了较新版本的 matplotlib,我也尝试安装旧版本,但它的核心是使用 3.0.3 构建新的 package。 How can either install this version correctly or bypass the issue?如何正确安装此版本或绕过该问题?

pip3 install matplotlib==3.0.3 -U
Looking in indexes: https://pypi.org/simple, https://1205d49dc47b4644d672f57e74f850e6342693e3f0b8cf0b:****@packagecloud.io/agrible/internal/pypi/simple
Collecting matplotlib==3.0.3
  Using cached matplotlib-3.0.3.tar.gz (36.6 MB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cbungo0j/matplotlib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cbungo0j/matplotlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-cbungo0j/matplotlib/pip-egg-info
         cwd: /tmp/pip-install-cbungo0j/matplotlib/
    Complete output (51 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-cbungo0j/matplotlib/setup.py", line 225, in <module>
        msg = pkg.install_help_msg()
      File "/tmp/pip-install-cbungo0j/matplotlib/setupext.py", line 650, in install_help_msg
        release = platform.linux_distribution()[0].lower()
    AttributeError: module 'platform' has no attribute 'linux_distribution'
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [3.0.3]
                    python: yes [3.8.2 (default, Apr 27 2020, 15:53:34)  [GCC
                            9.3.0]]
                  platform: yes [linux]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.18.5]
          install_requires: yes [handled by setuptools]
                    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: no  [pkg-config information for 'libpng' could not
                            be found.]
                     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
                       agg: yes [installing]
                     tkagg: yes [installing; run-time loading from Python Tcl /
                            Tk]
                    macosx: no  [Mac OS-X only]
                 windowing: no  [Microsoft Windows only]

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

    ============================================================================
                            * The following required packages can not be built:
                            * freetype, png
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Note I am installing this on Ubuntu with my windows machine.注意我正在用我的 windows 机器在 Ubuntu 上安装它。

matplotlib 3.0.3 provides wheels for Python 3.5-3.7 but not for 3.8 so pip is trying to build from sources and failed. matplotlib 3.0.3 为 Python 3.5-3.7提供轮子,但不为 3.8 提供轮子,因此pip正在尝试从源构建并失败。

Use Python 3.7.使用 Python 3.7。 Or install dependencies and build from sources .或者安装依赖项从源代码构建

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM