【问题标题】:Docker couldn't install python-ldapDocker 无法安装 python-ldap
【发布时间】:2019-11-30 19:12:33
【问题描述】:

我有一个需要 LDAP 身份验证的 Python 烧瓶应用程序。我正在尝试为此创建一个 Docker 文件,但 docker build 失败并出现以下错误,

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

我已经安装了 python-ldap,pip install -r requirements.txt 也可以正常工作,但是 Docker 给出了一个错误。我有 Mac 操作系统。

我查找了以前的问题,发现您应该尝试安装依赖项,

sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev

但是如何在 Mac 中解决这个问题?

这是 DockerFile 的摘录,

运行 pip install -r requirements.txt

另外我没有使用虚拟环境。

【问题讨论】:

标签: python docker ldap


【解决方案1】:

在您尝试构建映像时是否失败?

如果是这样,那么您的 docker 映像似乎没有预装 gcc。 尝试运行:

yum install gcc / python-devel

在尝试安装 python 包之前在你的 Dockerfile 中。

【讨论】:

  • 是的,它在构建映像时失败了。看起来我们会在不满足 ldap 的依赖关系时收到此错误,但我已将所有依赖关系包含在 requirements.txt 中。
猜你喜欢
  • 2022-06-21
  • 2011-06-13
  • 2014-01-12
  • 2019-05-07
  • 1970-01-01
  • 1970-01-01
  • 2022-11-15
  • 1970-01-01
  • 2020-01-07
相关资源
最近更新 更多