During installation python-ldap using pip (pip install python-ldap) I receive error:
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
I'm doing this inside my virtual environment (python -m venv)
I was trying to find answer for my question here:
- Python.h: No such file or directory when installing pandas
- How to install python3-devel on red hat 7
- fatal error: Python.h: No such file or directory
Steps which were made in order to try to fix the error but didn't:
yum install rh-python36-python-devel.x86_64
I have also checked if Python.h file is inside one of the gcc command from pip arguments:
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/opt/rh/rh-python36/root/usr/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=3.2.0 -DLDAPMODULE_AUTHOR=python-ldap project -DLDAPMODULE_LICENSE=Python style -IModules -I/me01/apps/onetick/apps/temp/venv2/include -I/opt/rh/rh-python36/root/include/python3.6m -c Modules/LDAPObject.c -o build/temp.linux-x86_64-3.6/Modules/LDAPObject.o
And the Python.h is not located inside all above locations, it is inside /opt/rh/rh-python36/root/usr/include/python3.6m/Python.h. Question is:
How to modify gcc command which is executed by pip?
PS Also tried
"pip command here" --global-option=build_ext --global-option="-l /path/to/libraries/"
PSS I have found workaround:
Copy libraries inside venv/include.