在Python 3.9(在Deepin系统中采用源码安装Python 3.9版本的方法)上安装matplotlib提示需要FreeType 2.3或更高版本,可以将MPLLOCALFREETYPE环境变量设置为1,以使Matplotlib下载它的提示,以下是错误信息和解决方法。
错误信息 gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -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/usr/local/lib/python3.9/site-packages/numpy/core/include -I/usr/local/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 <FILENAME> 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/local/bin/gcc' failed with exit code 1 ----------------------------------------
错误解读 需要FreeType 2.3或更高版本,你可以将MPLLOCALFREETYPE环境变量设置为1,以使Matplotlib下载它。 使用FreeType版本FREETYPE_MAJOR.FREETYPE_MINOR.FREETYPE_PATCH进行编译。
解决方法 在终端中依次执行以下命令: sudo apt-get install libfreetype6-dev sudo apt-get install pkg-config sudo apt-get install libpng12-dev sudo apt-get install pkg-config 执行完以上命令就可以使它正常工作了。
相关主题 |