Python.h:没有安装 python36-devel 的文件或目录

问题描述

我为此搜索了线程的色调。
当我安装 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 指向这个目录?

解决方法

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

yum install rh-python36-python-devel