【问题标题】:Python.h: No such file or directory with python36-devel installedPython.h:没有安装 python36-devel 的此类文件或目录
【发布时间】:2021-07-22 01:01:40
【问题描述】:

我已经为此搜索了线程的音调。
当我安装 python-ldap 我得到:

  In file included from Modules/LDAPObject.c:3:0:
  Modules/common.h:9:20: fatal error: Python.h: No such file or directory
   #include "Python.h"
                      ^
  compilation terminated.
  error: command 'gcc' failed with exit status 1

我有 Python 3.6 并且我已经安装了 python36-developenldap-devel
据我所知:

[xfft@hostname Scripts]$ pkg-config --cflags python
-I/usr/include/python2.7
[xfft@hostname Scripts]$ pkg-config --libs python
-lpython2.7

/usr/include/ 我有:

drwxr-xr-x.  2 root root   4096 Apr 28 14:35 python2.7
drwxr-xr-x.  2 root root   4096 Apr 28 14:51 python3.6m

python3.6m 中有 Python.h
但是如何将 pkg-config --cflags pythonpkg-config --libs python 指向这个目录呢?

【问题讨论】:

    标签: python gcc gcc-warning pkg-config


    【解决方案1】:

    如果有人提出类似问题,以下是解决问题的方法:
    我检查了 /opt/rh/rh-python36/root/usr/lib64/ 里面没有 pkgconfig 目录。
    我缺少的是 rh-python36-python-devel。所以这解决了这个问题:

    yum install rh-python36-python-devel
    

    【讨论】:

      猜你喜欢
      • 2016-08-17
      • 2019-12-21
      • 2012-06-17
      • 2021-08-27
      • 1970-01-01
      • 2017-03-02
      • 2022-09-29
      • 2020-09-15
      • 2017-12-13
      相关资源
      最近更新 更多