Problème de construction de Matplotlib: erreur C1083: impossible d'ouvrir le fichier include: 'ft2build.h'
ft2build.h se trouve ici:
C:Program fichiersGnuWin32include
initialement, j'ai fait la même erreur qu'ici:
mais depuis lors, j'ai corrigé cette erreur particulière (j'ai ajouté le répertoire ci-dessus au "include" de la liste, plutôt que de la "executables"), mais j'obtiens toujours 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 libmatplotlibmpl-datamatplotlibrc -> buildlib.win32-2.6matplotlibm
pl-data
copying libmatplotlibmpl-datamatplotlib.conf -> buildlib.win32-2.6matplotli
bmpl-data
running build_ext
building 'matplotlib.ft2font' extension
C:Program FilesMicrosoft Visual Studio 9.0VCBINcl.exe /c /nologo /Ox /MD /W
3 /GS- /DNDEBUG -IC:Python26libsite-packagesnumpycoreinclude -I. -IC:Pyth
on26libsite-packagesnumpycoreincludefreetype2 -I.freetype2 -IC:Python26
include -IC:Python26includeStackless -IC:Python26PC /Tpsrc/ft2font.cpp /Fob
uildtemp.win32-2.6Releasesrc/ft2font.obj
ft2font.cpp
C:Program FilesMicrosoft Visual Studio 9.0VCINCLUDExlocale(342) : warning C
4530: C++ exception handler used, but unwind semantics are not enabled. Specify
/EHsc
c:python26libsite-packagesmatplotlib-0.98.5.2srcft2font.h(13) : fatal erro
r C1083: Cannot open include file: 'ft2build.h': No such file or directory
error: command '"C:Program FilesMicrosoft Visual Studio 9.0VCBINcl.exe"' fa
iled with exit status 2
je dois mentionner que C'est Python 2.6
8 réponses
avez-vous installé freetype correctement? Si vous avez, il devrait y avoir un fichier nommé ft2build.h
quelque part sous le répertoire d'installation, et le répertoire où ce fichier est trouvé est celui que vous devez spécifier avec -I
. La chaîne de caractères "GnuWin32" n'apparaît nulle part dans la sortie de votre commande de compilation, il semble donc que vous n'ayez pas placé ce répertoire dans la liste d'inclusions correcte.
cette erreur se produit lors de la construction matplotlib sur Ubuntu 10.10 également. La solution est de 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 (léopard des neiges) et Python 2.7. , la solution la plus facile que j'ai trouvé était d'obtenir un fichier make qui télécharge Numpy, scipy et matplotlib et les compiler pour vous. Vous pouvez personnaliser le fichier de créer pour vous matplotlib. Voici le lien à la solution.
j'ai eu la même erreur dans red hat 6. Il s'avère que j'avais besoin d'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 sur Mac OS X. Cependant, ce n'était pas suffisant, car les bibliothèques n'étaient pas correctement liées sous Mac OS X 10.7. J'ai donc dû les ajouter manuellement à la commande pip
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 n'est pas inclus par défaut sur la notification homebrew, mais qui aura pour résultat de ne pas trouver ft2build.h
.
j'ai pu résoudre cela sur Windows en faisant ce qui 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 windows peuvent être trouvées ici: http://www.lfd.uci.edu/~gohlke/pythonlibs / #matplotlib (du commentaire de meawoppl)
il suffit de télécharger le " matplotlib-1.x‑windows‑lien‑les bibliothèques.zip", et ouvrez le fichier README de l'archive zip.
Téléchargez votre fichier dans un dossier sur votre lecteur C.
Dans l'invite CMD de windows en tant Qu'administrateur, naviguez sur votre chemin en utilisant
cd..
ou cd wheels
(dans mon cas j'ai sauvegardé le fichier à c:\Wheels
)
puis tapez 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