Docker:离线安装python软件包

时间:2020-03-25 09:40:05

标签: python docker pip

我要做什么?

使用下载的滚轮文件安装requirements.txt中提到的所有依赖项,即在 Docker

中脱机安装软件包

我做了什么?

在此之后,thread我设法使用mkdir wheelhouse && pip download -r requirements.txt -d wheelhouse将所有轮子下载到Wheelhouse文件夹中,并创建了一个压缩的tarball wheelhouse.tar.gz,其中包含我所有已下载的.whl文件requirements.txt

当我尝试使用pip install -r wheelhouse/requirements.txt --no-index --find-links wheelhouse在本地(Docker外部)安装轮子时,它可以工作!

但是当我在Docker中运行相同代码时,它没有以下错误:

Processing ./wheelhouse/beautifulsoup4-4.8.2-py3-none-any.whl 
ERROR: Could not find a version that satisfies the requirement blis==0.4.1 (from -r ./wheelhouse/requirements.txt (line 2)) (from versions: none)
ERROR: No matching distribution found for blis==0.4.1 (from -r ./wheelhouse/requirements.txt (line 2))

实际上,blis 0.4.1的车轮在我的驾驶室目录中。

谁能帮我确定为什么它不能在Docker上运行而在本地运行吗?

Dockerfile

FROM python:3

COPY . /app
WORKDIR /app

RUN tar -zxf ./wheelhouse.tar.gz 

RUN pip install -r ./wheelhouse/requirements.txt --no-index --find-links ./wheelhouse

wheelhouse目录的屏幕截图

c

0 个答案:

没有答案