2009-04-17 99 views
26

ft2build.h se encuentra aquí:Matplotlib Construir Problema: C1083 de error: No se puede abrir archivo de inclusión: 'ft2build.h'

C: \ Archivos de programa \ GnuWin32 \ include

Inicialmente, hice el mismo error que aquí:

Fatal Error C1083: Cannot Open Include file: 'tiffio.h': No such file or directory VC++ 2008

pero desde entonces, he corregido el error que en particular (he añadido el directorio anterior al "incluido ude "lista, en lugar de la lista de" ejecutables "), pero sigo recibiendo un error. La salida completa es la siguiente:

BUILDING MATPLOTLIB 
      matplotlib: 0.98.5.2 
       python: 2.6.2 Stackless 3.1b3 060516 (release26-maint, Apr 
         14 2009, 21:19:36) [MSC v.1500 32 bit (Intel)] 
       platform: win32 
     Windows version: (5, 1, 2600, 2, 'Service Pack 3') 

REQUIRED DEPENDENCIES 
       numpy: 1.3.0 
      freetype2: found, but unknown version (no pkg-config) 
         * WARNING: Could not find 'freetype2' headers in any 
         * of '.', '.\freetype2'. 

OPTIONAL BACKEND DEPENDENCIES 
       libpng: found, but unknown version (no pkg-config) 
         * Could not find 'libpng' headers in any of '.' 
       Tkinter: no 
         * No tk/win32 support for this python version yet 
       wxPython: 2.8.9.2 
         * WxAgg extension not required for wxPython >= 2.8 
        Gtk+: no 
         * Building for Gtk+ requires pygtk; you must be able 
         * to "import gtk" in your build/install environment 
     Mac OS X native: no 
        Qt: no 
        Qt4: no 
       Cairo: no 

OPTIONAL DATE/TIMEZONE DEPENDENCIES 
       datetime: present, version unknown 
       dateutil: matplotlib will provide 
        pytz: matplotlib will provide 

OPTIONAL USETEX DEPENDENCIES 
       dvipng: no 
      ghostscript: no 
       latex: no 
       pdftops: no 

[Edit setup.cfg to suppress the above messages] 
============================================================================ 
pymods ['pylab'] 
packages ['matplotlib', 'matplotlib.backends', 'matplotlib.projections', 'mpl_to 
olkits', 'matplotlib.numerix', 'matplotlib.numerix.mlab', 'matplotlib.numerix.ma 
', 'matplotlib.numerix.npyma', 'matplotlib.numerix.linear_algebra', 'matplotlib. 
numerix.random_array', 'matplotlib.numerix.fft', 'matplotlib.delaunay', 'pytz', 
'dateutil', 'dateutil/zoneinfo'] 
running build 
running build_py 
copying lib\matplotlib\mpl-data\matplotlibrc -> build\lib.win32-2.6\matplotlib\m 
pl-data 
copying lib\matplotlib\mpl-data\matplotlib.conf -> build\lib.win32-2.6\matplotli 
b\mpl-data 
running build_ext 
building 'matplotlib.ft2font' extension 
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W 
3 /GS- /DNDEBUG -IC:\Python26\lib\site-packages\numpy\core\include -I. -IC:\Pyth 
on26\lib\site-packages\numpy\core\include\freetype2 -I.\freetype2 -IC:\Python26\ 
include -IC:\Python26\include\Stackless -IC:\Python26\PC /Tpsrc/ft2font.cpp /Fob 
uild\temp.win32-2.6\Release\src/ft2font.obj 
ft2font.cpp 
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C 
4530: C++ exception handler used, but unwind semantics are not enabled. Specify 
/EHsc 
c:\python26\lib\site-packages\matplotlib-0.98.5.2\src\ft2font.h(13) : fatal erro 
r C1083: Cannot open include file: 'ft2build.h': No such file or directory 
error: command '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' fa 
iled with exit status 2 

Debo mencionar que este es Python 2.6

Respuesta

14

¿Ha instalado correctamente freetype? Si lo tiene, debe haber un archivo llamado ft2build.h en algún lugar debajo del directorio de instalación, y el directorio donde se encuentra ese archivo es el que debe especificar con -I. La cadena "GnuWin32" no aparece en ningún lugar en el resultado de su comando de compilación, por lo que parece que no ha colocado ese directorio en la lista de inclusión correcta.

+0

Gracias, acabé encontrando y mover ft2build.h a un directorio del que estaba seguro estaría incluido. –

+1

Cuando esté en Windows, considere usar binarios preconstruidos. [Este repositorio] (http://www.lfd.uci.edu/~gohlke/pythonlibs/) de archivos binarios no oficiales ha sido un salvavidas para mí. – meawoppl

3

Para aquellos que puedan tener el mismo problema pero en un Mac OS 10.6 (leopardo de las nieves) y Python 2.7. , la solución más fácil que encontré fue obtener un archivo make que descarga Numpy, scipy y matplotlib y compilarlos para usted. Puede personalizar el archivo make para obtener solo matplotlib. Aquí está el link a la solución.

60

Este error se produce al construir matplotlib en Ubuntu 10.10 también. La solución es hacer:

sudo apt-get install python-dev libfreetype6-dev 
+8

El OP está en Windows, por lo que probablemente no sea demasiado útil para él, pero +1 me ayudó a resolverlo en mi máquina. –

3

que tenía el mismo error en el sombrero rojo 6. Resulta que necesitaba para instalar freetype-devel, no freetype (usando sudo yum install freetype-devel)

7

Otra solución para Mac OS X es instala Freetype con Homebrew.

brew install freetype 
2

También me fijo este problema instalando freetype usando homebrew en Mac OS X. Sin embargo, eso no fue suficiente, ya que las bibliotecas no estaban vinculados correctamente bajo Mac OS X 10.7. Así que he tenido que añadir manualmente a pip de comandos de la siguiente manera:

brew install freetype 
brew install libpng 
LDFLAGS="-L/usr/local/opt/freetype/lib -L/usr/local/opt/libpng/lib" CPPFLAGS="-I/usr/local/opt/freetype/include -I/usr/local/opt/libpng/include -I/usr/local/opt/freetype/include/freetype2" pip install matplotlib 

Tenga en cuenta que también hay que añadir la carpeta /usr/local/opt/freetype/include/freetype2, que no se incluye por defecto en la notificación homebrew, pero dará lugar a no encontrar ft2build.h.

+0

¡gracias! esto funcionó para mí en 10.9.5 también. – Jack

2

que era capaz de resolver esto en Windows haciendo lo siguiente:

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

Las bibliotecas de enlace para Freetype en las ventanas se pueden encontrar aquí: http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib (de comentario de meawoppl)

sólo tiene que descargar el " matplotlib-1.x-windows-link-libraries.zip ", y abra el archivo README desde el zip.

0

Descargue su archivo a una carpeta en su disco C. En las ventanas prompt cmd como administrador a navegar su ruta utilizando cd.. o cd wheels (en mi caso me guardó el archivo en c:\Wheels) continuación, escriba pip install YourFilename.whl

Resultados en

Processing c:\wheels\scipy-0.19.0-cp27-cp27m-win_amd64.whl 
Requirement already satisfied: numpy>=1.8.2 in c:\python27\lib\site-packages (from scipy==0.19.0) 
Installing collected packages: scipy 
Successfully installed scipy-0.19.0 
Cuestiones relacionadas