当前位置:  开发笔记 > 编程语言 > 正文

Matplotlib构建问题:错误C1083:无法打开包含文件:'ft2build.h'

如何解决《Matplotlib构建问题:错误C1083:无法打开包含文件:'ft2build.h'》经验,为你挑选了3个好方法。

ft2build.h位于:

C:\ Program Files\GnuWin32\include

最初,我犯了同样的错误:

致命错误C1083:无法打开包含文件:'tiffio.h':没有这样的文件或目录VC++ 2008

但从那时起,我已经纠正了这个特定的错误(我已将上面的目录添加到"include"列表,而不是"可执行文件"列表),但我仍然收到错误.完整的输出是这样的:

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

我应该提一下,这是Python 2.6



1> 小智..:

在Ubuntu 10.10上构建matplotlib时也会出现此错误.解决方案是:

sudo apt-get install python-dev libfreetype6-dev


OP在Windows上,所以可能对他没有太大的帮助,但+1帮助我在我的机器上解决这个问题.

2> Jouni K. Sep..:

你是否正确安装了freetype?如果有,则应该ft2build.h在安装目录下有一个名为somewhere 的文件,并且找到该文件的目录是您应该指定的目录-I.字符串"GnuWin32"不会出现在构建命令的输出中的任何位置,因此看起来您没有将该目录放在正确的包含列表中.


在Windows上时,请考虑使用预构建的二进制文件。[这个存储库](http://www.lfd.uci.edu/~gohlke/pythonlibs/)的非官方二进制文件对我来说是一个救命稻草。

3> JoshNahum..:

Mac OS X的另一个解决方案是使用Homebrew安装Freetype.

brew install freetype

推荐阅读
php
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有