我正试图创建一个以ubutu16.04为基地的对接者形象。我想安装一些像熊猫、水瓶等巨蟒包。我把所有的包都放在"requirements.txt“里。但当我试图塑造形象时,我得到的是
Could not find a version that satisfies the requirement requests (from -r requirements.txt (line 1)) (from versions: )
No matching distribution found for requests (from -r requirements.txt (line 1))基本上,我在"requirements.txt“中没有提到任何版本。我想它应该采用该软件包的最新版本和兼容版本。但我得到的每一个包裹都是一样的。
我的DockerFile如下。
FROM ubuntu:16.04
RUN apt-get update -y && \
apt-get install -y python3-pip python3-dev build-essential cmake pkg-config libx11-dev libatlas-base-dev
# We copy just the requirements.txt first to leverage Docker cache
COPY ./requirements.txt /testing/requirements.txt
WORKDIR /testing
RUN pip3 install -r requirements.txt而requirements.txt是。
pandas
requests
PyMySQL
Flask
Flask-Cors
Pillow
face-recognition
Flask-SocketIO我在哪里做错事?有人能帮忙吗?
发布于 2019-11-15 09:50:37
我也遇到了同样的情况。我注意到,python包正在寻找docker中的网络。它认为,它是运行在一个独立的没有网络,所以它无法定位的包。在这种情况下
没有找到匹配的分布
或者有时候
重试..。
可能会发生错误。
我在docker命令中使用了一个--网络选项,如下所示,以克服此错误,该命令坚持python使用主机网络下载所需的包。
docker
发布于 2019-11-15 05:20:10
试着使用以下方法:
运行python3.6 -m pip安装--升级pip \ & python3.6 -m pip安装-r requirements.txt
通过以这种方式使用它,您将指定要在其中搜索这些包的python版本。
如果希望使用3.7版本,请将其更改为python3.7。
发布于 2019-11-15 05:36:42
我建议使用官方的python图像代替。因此,您的Dockerfile现在将变成:
FROM python:3
WORKDIR /testing
COPY ./requirements.txt /testing/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
... etc ...re:角/节点。这里有两个选项: 1)在Python映像上安装角/节点;或者2)使用Docker的多阶段构建功能,以便在合并它们之前构建角映像和特定于Python的映像。建议采用备选案文2,但需要做一些工作。可能看起来是这样的:
FROM node:8 as node
# Angular-specific build
FROM python:3 as python
# Python-specific build
# Then copy your data from the Angular image to the Python one:
COPY --from=node /usr/src/app/dist/angular-docker /usr/src/apphttps://stackoverflow.com/questions/58870704
复制相似问题