【问题标题】:configure: error: Python.h not found when it exists in Ubuntu 18配置:错误:在 Ubuntu 18 中找不到 Python.h
【发布时间】:2020-08-27 03:27:23
【问题描述】:

我正在尝试运行 ./configure --with-python 文件(我可以附加它,但它很长)并且我收到以下错误:

checking for gtest-config... no
File "<string>", line 1
import distutils.sysconfig; bl = distutils.sysconfig.get_config_var('BLDLIBRARY'); print bl if bl   else '-lpython2.7'
                                                                                              ^
SyntaxError: invalid syntax
File "<string>", line 1
import distutils.sysconfig; print distutils.sysconfig.get_config_var('INCLUDEPY')
                                              ^
SyntaxError: invalid syntax
checking Python.h usability... no
checking Python.h presence... no
checking for Python.h... no
configure: error: Python.h not found. Please install the devel package.

下一步,我运行:locate Python.h 这给了我:

/usr/include/python2.7/Python.h
/usr/include/python3.6m/Python.h
/usr/include/python3.7m/Python.h

下一步,我运行其中的每一个:

./configure --with-python=/usr/bin/python2.7
./configure --with-python=/usr/bin/python3.6m
./configure --with-python=/usr/include/python3.6m/Python.h

没有运气。

关于错误可能在哪里的任何指针?非常感谢!

【问题讨论】:

    标签: python c++ configure


    【解决方案1】:

    你不见了CFLAGS

    ./configure --with-python=/usr/bin/python2.7 CFLAGS="-I/usr/include/python2.7/
    

    【讨论】:

    • 谢谢。事实上,这是 CFLAG 的问题,也是 CMAKE 文件的问题。它期待 Python 2.7,而系统默认安装了 3.6。所以最后我不得不对 CMAKE 应用补丁并添加 CFLAG。谢谢!!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-20
    • 1970-01-01
    • 2016-09-17
    • 2020-11-22
    • 2020-11-04
    • 2015-09-30
    相关资源
    最近更新 更多