Matplotlib Build-Problem: Fehler C1083: kann nicht geöffnet werden Include-Datei: 'ft2build.h'

StackOverflow https://stackoverflow.com/questions/762292

Frage

ft2build.h befindet sich hier:

C: \ Programme \ GnuWin32 \ include

Am Anfang habe ich den gleichen Fehler wie hier:

Fatal Fehler C1083: kann nicht geöffnet werden Include-Datei: 'tiffio.h': keine solche Datei oder das Verzeichnis VC ++ 2008

aber seitdem habe ich korrigiert, dass bestimmte Fehler (ich habe das obige Verzeichnis in die „include“ Liste hinzugefügt, anstatt die „Executables“ -Liste), aber ich habe noch einen Fehler. Die vollständige Ausgabe ist dies:

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

Ich sollte erwähnen, dass diese Python 2.6

War es hilfreich?

Lösung

Haben Sie freetype richtig installiert? Wenn Sie haben, soll es eine Datei ft2build.h irgendwo unter dem Installationsverzeichnis genannt werden, und das Verzeichnis, in dem die Datei gefunden wird, ist diejenige, die Sie mit -I angeben sollen. Die Zeichenfolge „GnuWin32“ nicht überall in der Ausgabe des Build Befehl erscheinen, so sieht es aus wie Sie nicht gesetzt haben, dass Verzeichnis in der richtigen Liste enthalten.

Andere Tipps

Dieser Fehler kommt beim Bau matplotlib auf Ubuntu 10.10 auch. Die Lösung ist zu tun:

sudo apt-get install python-dev libfreetype6-dev

Eine andere Lösung für Mac OS X ist Freetype mit Homebrew zu installieren.

brew install freetype

Für diejenigen, die das gleiche Problem haben könnten, aber auf einem Mac OS 10.6 (Snow Leopard) und Python 2.7. I, die einfachste Lösung gefunden war eine Make-Datei zu erhalten, die herunterlädt Numpy, scipy und matplotlib und kompilieren sie für Sie. Sie können die Make-Datei anpassen, um nur erhalten Sie matplotlib. Hier ist der Link zur Lösung.

Ich hatte die gleichen Fehler im roten Hut 6. Es stellte sich heraus, dass ich brauchte freetype-devel zu installieren, nicht freetype (mit sudo yum install freetype-devel)

ich dieses Problem auch durch die Installation von Freetype Fest jedoch mit Homebrew auf Mac OS X, das war nicht ausreichend, da die Bibliotheken nicht richtig 10.7 unter Mac OS X verbunden waren. Also musste ich sie manuell hinzufügen Befehl pip wie folgt:

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 

Beachten Sie, dass Sie auch den Ordner /usr/local/opt/freetype/include/freetype2 hinzufügen müssen, die nicht standardmäßig auf der Homebrew-Meldung enthalten ist, werden in nicht zu finden ft2build.h aber zur Folge hat.

Ich konnte dies unter Windows lösen, indem Sie folgendermaßen vorgehen:

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

Die Link-Bibliotheken für Freetype auf Windows finden Sie hier: http: // www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib (von meawoppl Kommentar)

Laden Sie einfach die "matplotlib-1.x-windows-link-libraries.zip", und öffnen Sie die Readme aus der Zip.

Laden Sie Ihre Datei in einen Ordner auf Ihrem Laufwerk C. Im Fenster CMD als Administrator aufgefordert, navigieren Sie Ihren Weg mit cd.. oder cd wheels (in meinem Fall gespeichert ich die Datei c:\Wheels) dann Typ pip install YourFilename.whl

Ergebnisse in

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
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top