8

我正在尝试使用 pip 安装 python-ldap 包。执行时出现以下错误pip install python-ldap。我尝试根据这个问题安装与 ubuntu 17.10 ( Artful ) 对应的软件包,但还没有运气。我缺少什么包裹?

上述堆栈溢出问题的解决方案是安装 sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev 但在 17.10 中我看不到libsasl2-dev&libldap2-dev而我可以看到包libsasl-2-2& libldap-2.4-2。我将它们与phthon-dev&一起安装libssl-dev。但我仍然收到以下错误。似乎我缺少一些包含 lber.h 文件的软件包安装。

我得到的错误:

 In file included from Modules/LDAPObject.c:8:0:
    Modules/constants.h:7:10: fatal error: lber.h: No such file or directory
     #include "lber.h"
              ^~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Python 版本 - 3.6.3

点子版本 - 19.1.1

4

2 回答 2

18

我自己已经找到了根本原因。问题似乎是开发包本身。需要安装libsasl2-devlibldap2-dev& libssl-dev。我无法在 17.10 中看到这些包,因为主存储库镜像 url 已更改,因为版本已根据以下问题存档。

https://askubuntu.com/questions/1141501/i-cant-run-sudo-apt-get-update-in-ubuntu-17-10

我已更改为 18.04,安装上述软件包后一切正常。

于 2019-06-10T05:23:53.087 回答
4

这对我有用:

apt-get update -y && apt-get install -y python3-dev libldap2-dev libsasl2-dev ldap-utils tox lcov valgrind
于 2021-08-05T20:27:25.130 回答