python - Docker 无法安装 python-ldap
问题描述
我有一个需要 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
另外我没有使用虚拟环境。
解决方案
尝试构建图像时是否失败?
如果是这样,那么您的 docker 映像似乎没有预装 gcc。尝试运行:
yum install gcc / python-devel
在尝试安装 python 包之前在你的 Dockerfile 中。
推荐阅读
- css - 尝试使用 Flexbox 实现一列拆分为行的多列布局
- c++ - Qt 插件可以改变主应用程序创建的 UI 吗?
- python - 有没有办法在 Python 中模拟多个鼠标指针?
- python - Python字典键和结构问题
- ldap - 尝试修改 olcDatabase={2}hdb.ldif 时没有此类对象 (32) 错误
- azure-language-understanding - 解析 LUIS 预测结果实体 JSON
- javascript - 为 Cytoscape.js 中的某些子节点添加特定颜色
- themes - 雨果主题子模块标记为脏,不更新
- c# - 使用 ActionResult 测试 web api 控制器
- asp.net - 复选框助手返回空值的问题 ASP.NET MVC