Matplotlib Desenvolver Problema: Erro C1083: Não é possível abrir arquivo de inclusão: 'ft2build.h'
-
11-09-2019 - |
Pergunta
ft2build.h está localizado aqui:
C: \ Program Files \ GnuWin32 \ include
Inicialmente, eu cometi o mesmo erro que aqui:
mas, desde então, eu corrigido que determinado erro (eu adicionei o diretório acima à lista de "incluir", ao invés da lista "executáveis"), mas eu ainda obter um erro. A saída completa é a seguinte:
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
Eu devo mencionar que esta é Python 2.6
Solução
Você instalou freetype corretamente? Se tiver, deve haver um arquivo chamado em algum lugar ft2build.h
sob o diretório de instalação eo diretório onde esse arquivo é encontrado é aquele que você deve especificar com -I
. A string "GnuWin32" não aparece em qualquer lugar a saída do seu comando de compilação, então parece que você não tenha colocado nesse diretório na correta incluem lista.
Outras dicas
Este erro ocorre quando a construção matplotlib no Ubuntu 10.10 também. A solução é fazer:
sudo apt-get install python-dev libfreetype6-dev
Outra solução para o Mac OS X é instalar Freetype com Homebrew.
brew install freetype
Para aqueles que possam ter o mesmo problema, mas em um Mac OS 10.6 (Snow Leopard) e Python 2.7. , A solução mais fácil que eu encontrei foi a de obter um arquivo make que baixa Numpy, scipy e matplotlib e compilá-los para você. Você pode personalizar o arquivo make para você matplotlib somente. Aqui está a ligação para a solução.
Eu tive o mesmo erro no chapéu vermelho 6. Acontece que eu precisava para instalar freetype-devel
, não freetype
(usando sudo yum install freetype-devel
)
Eu também fixa este problema instalando freetype usando homebrew no Mac OS X. No entanto, isso não foi suficiente, como as bibliotecas não estavam ligados corretamente sob Mac OS X 10.7. Então eu tive que adicioná-los manualmente ao comando pip
da seguinte forma:
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
Note que você também tem que adicionar o /usr/local/opt/freetype/include/freetype2
pasta, que não está incluído por padrão na notificação homebrew, mas irá resultar em não encontrar ft2build.h
.
Eu era capaz de resolver isso no Windows fazendo o seguinte:
set INCLUDE=%INCLUDE%;C:\tmp\msvcr90-x32
set LIB=%LIB%;C:\tmp\msvcr90-x32
pip.exe install matplotlib
As bibliotecas de ligação para Freetype nas janelas pode ser encontrada aqui: http: // www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib (de comentário das meawoppl)
Basta baixar o "matplotlib-1.x-windows-link-libraries.zip" e abra o README do zip.
o download do arquivo para uma pasta no seu drive C.
Em janelas Prompt CMD como navegar Administrador-lhe o seu caminho usando
cd..
ou cd wheels
(no meu caso eu salvo o arquivo para c:\Wheels
)
em seguida, digite pip install YourFilename.whl
Os resultados em
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