Matplotlib construire Problème: Erreur C1083: Impossible d'ouvrir le fichier à inclure: « ft2build.h »

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

Question

ft2build.h se trouve ici:

C: \ Program Files \ GnuWin32 \ include

Dans un premier temps, je fait la même erreur que voici:

Fatal erreur C1083: Impossible d'ouvrir le fichier à inclure: 'tiffio.h': Aucun fichier ou répertoire VC ++ 2008

mais depuis, je l'ai corrigé cette erreur particulière (je l'ai ajouté le répertoire ci-dessus à la liste « inclure » la liste, plutôt que le « executables »), mais je reçois encore une erreur. La sortie complète est la suivante:

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

Je dois mentionner que ce Python 2.6

Était-ce utile?

La solution

Avez-vous installé freetype correctement? Si vous avez, il devrait y avoir un fichier nommé ft2build.h quelque part dans le répertoire d'installation et le répertoire dans lequel ce fichier se trouve est celui que vous devez spécifier avec -I. La chaîne « GnuWin32 » ne figure nulle part dans la sortie de votre commande de construction, il semble que vous ne l'avez pas placé ce répertoire dans la bonne liste d'inclusion.

Autres conseils

Cette erreur se produit lors de la construction matplotlib sur Ubuntu 10.10 aussi. La solution consiste à faire:

sudo apt-get install python-dev libfreetype6-dev

Une autre solution pour Mac OS X est d'installer Freetype avec Homebrew.

brew install freetype

Pour ceux qui pourraient avoir le même problème, mais sur un Mac OS 10.6 (Snow Leopard) et Python 2.7. , La solution la plus simple que j'ai trouvé pour obtenir un fichier make qui télécharge Numpy, scipy et Matplotlib et les compiler pour vous. Vous pouvez personnaliser le fichier makefile pour vous faire Matplotlib seulement. Voici le à la solution.

J'avais la même erreur dans le chapeau rouge 6. s'avère que je devais installer freetype-devel, pas freetype (en utilisant sudo yum install freetype-devel)

J'ai également corrigé ce problème en installant freetype en utilisant homebrew sous Mac OS X. Toutefois, cela ne suffisait pas, les bibliothèques ne sont pas liées correctement sous Mac OS X 10.7. Donc, je devais les ajouter manuellement pip commande comme suit:

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 

Notez que vous devez également ajouter le dossier /usr/local/opt/freetype/include/freetype2, qui ne sont pas inclus par défaut sur la notification homebrew, mais ne trouver ft2build.h.

J'ai pu résoudre ce sous Windows en procédant comme suit:

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

Les bibliothèques de liens pour Freetype sur les fenêtres se trouvent ici: http: // www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib (du commentaire de meawoppl)

Il suffit de télécharger le "matplotlib-1.x-windows-link-libraries.zip", et ouvrez le fichier README du zip.

Téléchargez votre fichier dans un dossier sur votre disque C. Dans les fenêtres CMD invite en tant qu'administrateur vous naviguez votre chemin à l'aide cd.. ou cd wheels (dans mon cas, je le fichier sauvé c:\Wheels) puis le type pip install YourFilename.whl

Résultats dans

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
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top