简体   繁体   English

docker 错误:由于 OSError 无法安装软件包:[Errno 2]

[英]docker ERROR: Could not install packages due to an OSError: [Errno 2]

hey guys getting this error when i try to docker image build -t py-test嘿,当我尝试docker image build -t py-test时出现此错误

ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/tmp/tmp_ohy_f6g/output.json'错误:由于 OSError 无法安装软件包:[Errno 2] 没有这样的文件或目录:'/tmp/tmp_ohy_f6g/output.json'

executor failed running [/bin/sh -c pip install ibm-db]: exit code: 1执行程序运行失败 [/bin/sh -c pip install ibm-db]:退出代码:1

dockerfile:码头文件:

FROM python:3.9.13-alpine3.16
WORKDIR /app
RUN pip install --upgrade setuptools
RUN pip install --upgrade pip
RUN pip install ibm-db
RUN pip install flask
EXPOSE 8080
COPY . .
CMD ["python", "output.py"]

Docker version 20.10.16, build aa7e414 Docker 版本 20.10.16,构建 aa7e414

macOS (localhost) version -- macos montery version 12.4 (21F79) macOS (localhost) 版本——macos montery 版本 12.4 (21F79)

After running the build with pip in verbose mode ( pip install -v ibm-db ), you can see the following error:在详细模式下使用pip运行构建后 ( pip install -v ibm-db ),您可以看到以下错误:

No Gcc installation detected.
Please install gcc and continue with the installation of the ibm_db.

ibm-db requires you to have gcc available when installing it, so that you can build it's C modules. ibm-db要求您在安装时提供gcc ,以便您可以构建它的 C 模块。

Installing gcc and libc-dev before ibm-db solves the issue:ibm-db解决问题之前安装gcclibc-dev

FROM python:3.9.13-alpine3.16

WORKDIR /app

RUN apk add gcc libc-dev

RUN pip install --upgrade setuptools
RUN pip install --upgrade pip
RUN pip install ibm-db
RUN pip install flask

COPY . .

EXPOSE 8080

CMD ["python", "output.py"]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:由于 OSError 无法安装软件包:[Errno 22] 参数无效 - ERROR: Could not install packages due to an OSError: [Errno 22] Invalid argument 错误:由于 OSError 无法安装软件包:[Errno 39] 目录不为空 - ERROR: Could not install packages due to an OSError: [Errno 39] Directory not empty 如何安装 requirements.txt pip 错误->由于 OSError 无法安装软件包:[Errno 2] 没有这样的文件或目录 - How to install requirements.txt pip error ->Could not install packages due to an OSError: [Errno 2] No such file or directory 错误:由于 OSError 无法安装软件包? - ERROR: Could not install packages due to an OSError? Python:由于 OSError 无法安装软件包:[Errno 2] 没有这样的文件或目录 - Python: Could not install packages due to an OSError: [Errno 2] No such file or directory Python:由于 OSError 无法安装包:[Errno 2] 没有这样的文件或目录 - Python: Could not install packages due to an OSError: [Errno 2] No such file or directory 错误:由于 OSError 无法安装软件包:[[Errno 22] 无效参数:'/tmp/pip-req-build] - ERROR: Could not install packages due to an OSError: [[Errno 22] Invalid argument: '/tmp/pip-req-build] pip install planemo 失败并出现错误:“错误:由于 OSError 无法安装软件包:[Errno 13] 权限被拒绝:'/usr/local/locale'” - pip install planemo fails with error: "ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/usr/local/locale'" Pip 安装包错误:由于 OSError 无法安装包 - Pip Install Package Error: Could not install packages due to an OSError 当我将我的 django 项目放在 Heroku 上时出现错误:错误:由于 OSError:[Errno 2],无法安装软件包 - I have an error when i put my django project on Heroku: ERROR: Could not install packages due to an OSError: [Errno 2]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM