我有一个Python flask应用程序,它需要LDAP身份验证。我正在尝试为此创建Docker文件,docker构建失败,出现以下错误,
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 OS。
我查找了之前的问题,发现您应该尝试安装依赖项,
sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
但是我如何在Mac中修复这个问题呢?
这是DockerFile的摘录,
运行pip安装-r requirements.txt
另外,我没有使用虚拟环境。
发布于 2019-07-23 03:18:53
在您尝试构建映像时,它是否失败了?
如果是这样的话,看起来您的docker镜像中并没有预装gcc。尝试运行:
yum install gcc / python-devel在尝试安装python包之前,请在Dockerfile中添加。
https://stackoverflow.com/questions/57152303
复制相似问题