开源改变世界

python3.8:配置:错误:缺少必需的标头Python.h。 #826

推推 grbl 2年前 (2023-01-30) 133次浏览
关闭
dwrobel 打开了这个问题 2020 年 5 月 4 日 · 3条评论
关闭

python3.8:配置:错误:缺少必需的标头Python.h。#826

dwrobel 打开了这个问题 2020 年 5 月 4 日 · 3条评论

注释

python3.8:配置:错误:缺少必需的标头Python.h。 #826
贡献者

我确实使用 python3.8 (Fedora rawhide 上的默认设置)编译了最新版本,但配置失败如下:

checking whether the Boost::Python headers are available... yes
checking for boost::python shared library... -lboost_python38
checking /usr/include/python3.8/Python.h usability... no
checking /usr/include/python3.8/Python.h presence... no
checking for /usr/include/python3.8/Python.h... no
configure: error: Required header Python.h missing.  Install it, or specify --disable-python to skip the parts of LinuxCNC that depend on Python
error: Bad exit status from /var/tmp/rpm-tmp.ALK00P (%prep)

更详细的输出:

configure:9678: gcc -c -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib
In file included from /usr/include/python3.8/pystate.h:129,
                 from /usr/include/python3.8/genobject.h:11,
                 from /usr/include/python3.8/Python.h:121,
                 from conftest.c:88:
/usr/include/python3.8/cpython/pystate.h:9:10: fatal error: cpython/initconfig.h: No such file or directory
    9 | #include "cpython/initconfig.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~

基本上,为了使用该标头,必须-I从 pkg-config() 中提供适当的选项。

我补充道:

export CPPFLAGS="$(pkg-config --cflags python3)"

但上面需要#751这取决于#755

但是,也避免手动传递CPPFLAGS给使用.configurepythonPKG_CHECK_MODULES()

python3.8:配置:错误:缺少必需的标头Python.h。 #826 rene-dev 添加了 蟒蛇3 标签 2020 年 5 月 6 日
python3.8:配置:错误:缺少必需的标头Python.h。 #826
贡献者
export CPPFLAGS="$(pkg-config --cflags python3)"

这允许我在 Arch 上配置

python3.8:配置:错误:缺少必需的标头Python.h。 #826
合作者

我在 Ubuntu 20.04 上有同样的问题

python3.8:配置:错误:缺少必需的标头Python.h。 #826
合作者

@dwrobel你能检查这是否解决了问题,如果没有请重新打开。