首页 > 解决方案 > 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指向这个目录?

标签: pythongccgcc-warningpkg-config

解决方案


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

yum install rh-python36-python-devel

推荐阅读