栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

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

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

(错误记录)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(’"’"’rn’"’"’, ‘"’"’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

解决页面如下:

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/738444.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号