【问题标题】:How to fix error on python django_auth_ldap如何修复 python django_auth_ldap 上的错误
【发布时间】:2017-11-29 07:04:05
【问题描述】:

我有问题!

当我尝试在 Windows x64、python 2.7 64 上安装 django_auth_ldap 时。我收到此错误:

控制台日志
pip install django_auth_ldap之后

    C:\Users\Dmisss\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_SASL -DLDAPMODULE_VERSION=2.5.2 "-DLDAPMODULE_AUTHOR=python-ldap project" "-DLDAPMODULE_LICENSE=Python style" -IModules -I/usr/include -I/usr/include/sasl -I/usr/local/include -I/usr/local/include/sasl -Ic:\python27\include -Ic:\python27\PC /TcModules/LDAPObject.c /Fobuild\temp.win-amd64-2.7\Release\Modules/LDAPObject.obj
    LDAPObject.c
    c:\users\dmisss\appdata\local\temp\pip-build-tcxk8h\python-ldap\modules\errors.h(7) : fatal error C1083: Cannot open include file: 'lber.h': No such file or directory
    error: command 'C:\\Users\\Dmisss\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2

    ----------------------------------------
   Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\dmisss\\appdata\\local\\temp\\pip-build-tcxk8h\\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 c:\users\dmisss\appdata\local\temp\pip-swbv4g-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\dmisss\appdata\local\temp\pip-build-tcxk8h\python-ldap\

【问题讨论】:

    标签: python django python-2.7


    【解决方案1】:

    来自documentation of django_auth_ldap

    在 Python 2 下,需要 python-ldap >= 2.0;在 Python 3 下,它使用 pyldap。 无论哪种情况,您都需要系统上可用的 OpenLDAP 库和标头。

    您似乎错过了安装 OpenLDAP 库和标头的部分,因为您的错误在这里显示:

    Cannot open include file: 'lber.h': No such file or directory
    

    安装说明OpenLDAP可以在这里找到:https://www.openldap.org/software/release/install.html

    【讨论】:

    • 我下载 python-ldap lfd.uci.edu/~gohlke/pythonlibs/#python-ldap 安装这个包。之后,我的安装 django_auth_ldap 就成功了。对不起我的英语,希望你能理解我
    • 在 Ubuntu 上,您需要运行以下命令:apt install libsasl2-dev libldap2-dev。如果您还没有安装 python-devlibssl-dev,您也可以选择需要它们。
    猜你喜欢
    • 2019-12-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-29
    相关资源
    最近更新 更多