Python 3.9上安装matplotlib时FreeType版本错误解决思路
Tofloor
poster avatar
hh5blxj
deepin
2020-05-24 06:49
Author
在Python3.9中安装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
       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
    ----------------------------------------



解决思路是:
sudo apt-get install libfreetype6-dev
sudo apt-get install pkg-config
sudo apt-get install libpng12-dev
sudo apt-get install pkg-config



   然后就可以正常工作了。记录一下。

Reply Favorite View the author
All Replies

No replies yet