安装Python-Ldap

操作系统:Centos 7.x

Python版本:3.6

[root@monitor JDANGO]# pip3 install Python-Ldap
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting Python-Ldap
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ea/93/596f875e003c770447f4b99267820a0c769dd2dc3ae3ed19afe460fcbad0/python-ldap-3.2.0.tar.gz
Requirement already satisfied: pyasn1>=0.3.7 in /usr/local/software/Python3.6.6/lib/python3.6/site-packages (from Python-Ldap) (0.4.4)
Collecting pyasn1_modules>=0.1.5 (from Python-Ldap)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/91/f0/b03e00ce9fddf4827c42df1c3ce10c74eadebfb706231e8d6d1c356a4062/pyasn1_modules-0.2.5-py2.py3-none-any.whl
Installing collected packages: pyasn1-modules, Python-Ldap
  Running setup.py install for Python-Ldap ... error
    Complete output from command /usr/local/software/Python3.6.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-u7kxzoln/Python-Ldap/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-gz5k180v/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    copying Lib/ldapurl.py -> build/lib.linux-x86_64-3.6
    copying Lib/ldif.py -> build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/ldap
    copying Lib/ldap/async.py -> build/lib.linux-x86_64-3.6/ldap
    copying Lib/ldap/syncrepl.py -> build/lib.linux-x86_64-3.6/ldap
    copying Lib/ldap/constants.py -> build/lib.linux-x86_64-3.6/ldap
    copying Lib/ldap/resiter.py -> build/lib.linux-x86_64-3.6/ldap
    copying Lib/ldap/pkginfo.py -> build/lib.linux-x86_64-3.6/ldap
    copying Lib/ldap/cidict.py -> build/lib.linux-x86_64-3.6/ldap
    copying Lib/ldap/functions.py -> build/lib.linux-x86_64-3.6/ldap
    copying Lib/ldap/modlist.py -> build/lib.linux-x86_64-3.6/ldap
    copying Lib/ldap/asyncsearch.py -> build/lib.linux-x86_64-3.6/ldap
    copying Lib/ldap/sasl.py -> build/lib.linux-x86_64-3.6/ldap
    copying Lib/ldap/filter.py -> build/lib.linux-x86_64-3.6/ldap
    copying Lib/ldap/dn.py -> build/lib.linux-x86_64-3.6/ldap
    copying Lib/ldap/compat.py -> build/lib.linux-x86_64-3.6/ldap
    copying Lib/ldap/ldapobject.py -> build/lib.linux-x86_64-3.6/ldap
    copying Lib/ldap/__init__.py -> build/lib.linux-x86_64-3.6/ldap
    copying Lib/ldap/logger.py -> build/lib.linux-x86_64-3.6/ldap
    creating build/lib.linux-x86_64-3.6/ldap/controls
    copying Lib/ldap/controls/readentry.py -> build/lib.linux-x86_64-3.6/ldap/controls
    copying Lib/ldap/controls/openldap.py -> build/lib.linux-x86_64-3.6/ldap/controls
    copying Lib/ldap/controls/vlv.py -> build/lib.linux-x86_64-3.6/ldap/controls
    copying Lib/ldap/controls/libldap.py -> build/lib.linux-x86_64-3.6/ldap/controls
    copying Lib/ldap/controls/simple.py -> build/lib.linux-x86_64-3.6/ldap/controls
    copying Lib/ldap/controls/sss.py -> build/lib.linux-x86_64-3.6/ldap/controls
    copying Lib/ldap/controls/pwdpolicy.py -> build/lib.linux-x86_64-3.6/ldap/controls
    copying Lib/ldap/controls/deref.py -> build/lib.linux-x86_64-3.6/ldap/controls
    copying Lib/ldap/controls/__init__.py -> build/lib.linux-x86_64-3.6/ldap/controls
    copying Lib/ldap/controls/psearch.py -> build/lib.linux-x86_64-3.6/ldap/controls
    copying Lib/ldap/controls/sessiontrack.py -> build/lib.linux-x86_64-3.6/ldap/controls
    copying Lib/ldap/controls/ppolicy.py -> build/lib.linux-x86_64-3.6/ldap/controls
    copying Lib/ldap/controls/pagedresults.py -> build/lib.linux-x86_64-3.6/ldap/controls
    creating build/lib.linux-x86_64-3.6/ldap/extop
    copying Lib/ldap/extop/dds.py -> build/lib.linux-x86_64-3.6/ldap/extop
    copying Lib/ldap/extop/__init__.py -> build/lib.linux-x86_64-3.6/ldap/extop
    creating build/lib.linux-x86_64-3.6/ldap/schema
    copying Lib/ldap/schema/subentry.py -> build/lib.linux-x86_64-3.6/ldap/schema
    copying Lib/ldap/schema/tokenizer.py -> build/lib.linux-x86_64-3.6/ldap/schema
    copying Lib/ldap/schema/__init__.py -> build/lib.linux-x86_64-3.6/ldap/schema
    copying Lib/ldap/schema/models.py -> build/lib.linux-x86_64-3.6/ldap/schema
    creating build/lib.linux-x86_64-3.6/slapdtest
    copying Lib/slapdtest/__init__.py -> build/lib.linux-x86_64-3.6/slapdtest
    copying Lib/slapdtest/_slapdtest.py -> build/lib.linux-x86_64-3.6/slapdtest
    running egg_info
    writing Lib/python_ldap.egg-info/PKG-INFO
    writing dependency_links to Lib/python_ldap.egg-info/dependency_links.txt
    writing requirements to Lib/python_ldap.egg-info/requires.txt
    writing top-level names to Lib/python_ldap.egg-info/top_level.txt
    reading manifest file 'Lib/python_ldap.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    no previously-included directories found matching 'Doc/.build'
    writing manifest file 'Lib/python_ldap.egg-info/SOURCES.txt'
    creating build/lib.linux-x86_64-3.6/slapdtest/certs
    copying Lib/slapdtest/certs/README -> build/lib.linux-x86_64-3.6/slapdtest/certs
    copying Lib/slapdtest/certs/ca.conf -> build/lib.linux-x86_64-3.6/slapdtest/certs
    copying Lib/slapdtest/certs/ca.pem -> build/lib.linux-x86_64-3.6/slapdtest/certs
    copying Lib/slapdtest/certs/client.conf -> build/lib.linux-x86_64-3.6/slapdtest/certs
    copying Lib/slapdtest/certs/client.key -> build/lib.linux-x86_64-3.6/slapdtest/certs
    copying Lib/slapdtest/certs/client.pem -> build/lib.linux-x86_64-3.6/slapdtest/certs
    copying Lib/slapdtest/certs/gencerts.sh -> build/lib.linux-x86_64-3.6/slapdtest/certs
    copying Lib/slapdtest/certs/gennssdb.sh -> build/lib.linux-x86_64-3.6/slapdtest/certs
    copying Lib/slapdtest/certs/server.conf -> build/lib.linux-x86_64-3.6/slapdtest/certs
    copying Lib/slapdtest/certs/server.key -> build/lib.linux-x86_64-3.6/slapdtest/certs
    copying Lib/slapdtest/certs/server.pem -> build/lib.linux-x86_64-3.6/slapdtest/certs
    running build_ext
    building '_ldap' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/Modules
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -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/usr/local/software/Python3.6.6/include/python3.6m -c Modules/LDAPObject.c -o build/temp.linux-x86_64-3.6/Modules/LDAPObject.o
    In file included from Modules/LDAPObject.c:8:0:
    Modules/constants.h:7:18: 致命错误:lber.h:没有那个文件或目录
     #include "lber.h"
                      ^
    编译中断。
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/local/software/Python3.6.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-u7kxzoln/Python-Ldap/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-gz5k180v/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-u7kxzoln/Python-Ldap/
You are using pip version 18.0, however version 19.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

解决方法:

yum -y install openldap-devel python-devel
2019-6-17 22:0:2
点赞