【问题标题】:Matplotlib ft2font build error (python3)Matplotlib ft2font 构建错误(python3)
【发布时间】:2013-02-06 14:42:03
【问题描述】:

尝试为 Python3 构建 matplotlib 时遇到以下错误。我已经安装了 Numpy 和 Scipy(包括调试扩展)。我还安装了 libpng12-0 和 libfreetype6(和调试),但仍然没有。

运行python3 setup.py build 后,我得到以下信息:

running build_ext
building 'matplotlib.ft2font' extension
gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -DPYCXX_PYTHON_2TO3=1 -I/usr/local/include -I/usr/include -I/usr/lib/python3/dist-packages/numpy/core/include -I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I. -I/usr/include/python3.2mu -c src/ft2font.cpp -o build/temp.linux-i686-3.2/src/ft2font.o
In file included from ./CXX/Extensions.hxx:37:0,
                 from src/ft2font.h:6,
                 from src/ft2font.cpp:3:
./CXX/WrapPython.h:58:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

tom@dev-Optiplex:~/Downloads/matplotlib$ sudo find / -name "ft2font*"
/home/tom/Downloads/matplotlib/src/ft2font.cpp
/home/tom/Downloads/matplotlib/src/ft2font.h
tom@dev-Optiplex:~/Downloads/matplotlib$ 

我似乎无法理解它,因为它似乎无法找到 src/ft2font.* 文件,但是当我搜索它们时,它们肯定存在。我错过了什么?

谢谢!

【问题讨论】:

  • 您好像缺少Python.h。你有没有安装 python3-dev 包?
  • 解决了问题,我错过了python3-dev!这是丢失包裹的标志是什么?如果您以完整答案的形式回答,我将接受并让业力下雨!

标签: python-3.x matplotlib


【解决方案1】:

您似乎缺少 Python.h。你有没有安装 python3-dev 包?

指示未找到的文件是Python.h

In file included from ./CXX/Extensions.hxx:37:0,<-- (2) an include file in (1)
                 from src/ft2font.h:6,    <-- (1) an include file in (0)
                 from src/ft2font.cpp:3:  <-- (0) file gcc was trying to compile
./CXX/WrapPython.h:58:20: fatal error: Python.h: No such file or directory
  ^ (3) an include in (2) with error      ^ the actually missing file

Python.h 是 python 的开发头。如果您不知道缺少的标头属于哪个包,您可以为您的发行版检查包装,其中大多数具有“按文件名搜索”功能。例如the ubuntu package listing

【讨论】:

    猜你喜欢
    • 2020-06-30
    • 2012-01-18
    • 2018-04-17
    • 2013-02-16
    • 1970-01-01
    • 2020-11-21
    • 2021-03-28
    • 1970-01-01
    • 2018-10-26
    相关资源
    最近更新 更多