最近服务器安装python-ldap出现了如下error:
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=3.4.2 "-DLDAPMODULE_AUTHOR=python-ldap project" "-DLDAPMODULE_LICENSE=Python style" -IModules -I/data/wwwroot/mck-prod.wuxibiologics.com/LS_OPS_with_digital_solution-moon_landing-main/backend/venv/include -I/usr/local/include/python3.9 -c Modules/LDAPObject.c -o build/temp.linux-x86_64-cpython-39/Modules/LDAPObject.o
In file included from Modules/LDAPObject.c:3:0:
Modules/common.h:15:18: fatal error: lber.h: No such file or directory
#include <lber.h>
^
compilation terminated.
error: command '/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for python-ldap
gcc报错了,一开始我们以为要升级gcc,结果只要执行如下命令即可。
yum install python-devel openldap-devel
然后再次执行安装python-ldap,就不会报错了。
pip install python-ldap