【python-err】pip安装 matplotlib 时问题记录

problem

在使用pip3 install matplotlib==3.0.3时遇到如下问题

Collecting matplotlib==3.0.3
Downloading matplotlib-3.0.3.tar.gz (36.6 MB)
|████████████████████████████████| 36.6 MB 4.2 MB/s 
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-y4m52gve/matplotlib_2a451fa2ef644074a5a57f0c114f3628/setup.py'"'"'; __file__='"'"'/tmp/pip-install-y4m52gve/matplotlib_2a451fa2ef644074a5a57f0c114f3628/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-pip-egg-info-y8nekcs3
cwd: /tmp/pip-install-y4m52gve/matplotlib_2a451fa2ef644074a5a57f0c114f3628/
Complete output (47 lines):
============================================================================
Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
matplotlib: yes [3.0.3]
python: yes [3.5.2 (default, Oct 7 2020, 17:19:02) [GCC
5.4.0 20160609]]
platform: yes [linux]

REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.16.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
* Try installing freetype with `apt-get install
* libfreetype6-dev` and pkg-config with `apt-get
* install pkg-config`
* Try installing png with `apt-get install
* libpng12-dev` and pkg-config with `apt-get install
* pkg-config`
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
View Code

系统环境:

ubuntu16.04

python3.5

原因

When freetype-config is missing, setup.py crashes with TypeError. This fixes it and allows the "required packages" info to be printed.
The bug is in the handling of searching for a freetype installation. If you install the Linux package freetype-dev, you will avoid this bug and be able to compile matplotlib.

解决方法

sudo apt-get install libfreetype6-dev

参考

1. pip安装 matplotlib 时问题记录

2. ubuntu 14.04, pip cannot upgrade matplotllib

3. Fixes TypeError when installing without freetype #3414

posted on 2020-12-21 20:59  鹅要长大  阅读(283)  评论(0编辑  收藏  举报

导航