Matplotlib Build Problem: Error C1083: Cannot open include file: 'ft2build.h'

后端 未结 11 2518
广开言路
广开言路 2020-12-03 02:24

ft2build.h is located here:

C:\\Program Files\\GnuWin32\\include

Initially, I made the same mistake as here:

Fatal

相关标签:
11条回答
  • 2020-12-03 03:17

    I was able to solve this on Windows by doing the following:

       set INCLUDE=%INCLUDE%;C:\tmp\msvcr90-x32
       set LIB=%LIB%;C:\tmp\msvcr90-x32
       pip.exe install matplotlib
    

    The link libraries for Freetype on windows can be found here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib (from meawoppl's comment)

    Just download the "matplotlib‑1.x‑windows‑link‑libraries.zip", and open the README from the zip.

    0 讨论(0)
  • 2020-12-03 03:19

    Have you installed freetype properly? If you have, there should be a file named ft2build.h somewhere under the installation directory, and the directory where that file is found is the one that you should specify with -I. The string "GnuWin32" does not appear anywhere in the output of your build command, so it looks like you have not placed that directory in the correct include list.

    0 讨论(0)
  • 2020-12-03 03:20

    This question comes up high in Google for this error, so like several others I'll ignore the fact that it's asking about Windows only.

    On Debian 10 (Buster) I had to do:

    sudo apt install libfreetype6-dev pkg-config
    

    Note the pkg-config dependency; without it, the FreeType headers get installed, but matplotlib is unable to find them. It warns about this before spitting out pages of output, so it's easy to miss:

    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
    
    0 讨论(0)
  • 2020-12-03 03:28

    I had the same error in red hat 6. Turns out that I needed to install freetype-devel, not freetype (using sudo yum install freetype-devel)

    0 讨论(0)
  • 2020-12-03 03:28

    I spent hours trying to get matplotlib to install with the latest python 3, pip, setuptools everything... What finally worked for me was going to https://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib downloading the wheel file and executing this in the same directory:

    pip install matplotlib‑3.2.0rc2‑cp38‑cp38‑win_amd64.whl
    
    0 讨论(0)
提交回复
热议问题