Python教程

(错误记录)python3.9安装matplotlib3.2.2版本失败解决

本文主要是介绍(错误记录)python3.9安装matplotlib3.2.2版本失败解决,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

错误一

安装过程中遇到:

在这里插入图片描述

ERROR: Command errored out with exit status 1: /home/welkin/Desktop/AFL/epf/.env/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-rwvrrmy9/matplotlib/setup.py’"’"’; file=’"’"’/tmp/pip-install-rwvrrmy9/matplotlib/setup.py’"’"’;f=getattr(tokenize, ‘"’"‘open’"’"’, open)(file);code=f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ install --record /tmp/pip-record-q37ze_jx/install-record.txt --single-version-externally-managed --compile --install-headers /home/welkin/Desktop/AFL/epf/.env/include/site/python3.9/matplotlib Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 22.0.3 is available.
You should consider upgrading via the ‘/home/Desktop/AFL/epf/.env/bin/python3 -m pip install --upgrade pip’ command.

这里只需要按照它的指示更新pip即可
输入:python3 -m pip install --upgrade pip' command
然后就会报第二个错误

错误二

setup script exited with error: command ‘x86_64-linux-gnu-gcc’ failed
with exit status 1
在这里插入图片描述
x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DFREETYPE_BUILD_TYPE=system -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D__STDC_FORMAT_MACROS=1 -Iextern/agg24-svn/include -I/home/welkin/Desktop/AFL/epf/.env/lib/python3.9/site-packages/numpy/core/include -I/home/welkin/Desktop/AFL/epf/.env/include -I/usr/include/python3.9 -c src/checkdep_freetype2.c -o build/temp.linux-x86_64-3.9/src/checkdep_freetype2.o
src/checkdep_freetype2.c:3:6: error: #error “FreeType version 2.3 or higher is required. You may set the MPLLOCALFREETYPE environment variable to 1 to let Matplotlib download it.”
3 | #error "FreeType version 2.3 or higher is required.
| ^~~~~
src/checkdep_freetype2.c:10:10: error: #include expects “FILENAME” or
10 | #include FT_FREETYPE_H
| ^~~~~~~~~~~~~
src/checkdep_freetype2.c:15:9: note: ‘#pragma message: Compiling with FreeType version FREETYPE_MAJOR.FREETYPE_MINOR.FREETYPE_PATCH.’
15 | #pragma message("Compiling with FreeType version "
| ^~~~~~~
src/checkdep_freetype2.c:18:4: error: #error “FreeType version 2.3 or higher is required. You may set the MPLLOCALFREETYPE environment variable to 1 to let Matplotlib download it.”
18 | #error "FreeType version 2.3 or higher is required.
| ^~~~~
error: command ‘/usr/bin/x86_64-linux-gnu-gcc’ failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

我的主机解决办法是:

sudo apt-get install libfreetype6-dev
sudo apt-get install pkg-config
sudo apt-get install libpng12-dev
sudo apt-get install pkg-config

解决页面如下:
在这里插入图片描述

这篇关于(错误记录)python3.9安装matplotlib3.2.2版本失败解决的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!