(错误记录)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
解决页面如下:
标签:checkdep,版本,matplotlib3.2,version,install,error,pip,include,python3.9 来源: https://blog.csdn.net/qq_40229814/article/details/122781799