【发布时间】:2020-06-01 16:46:32
【问题描述】:
我正在 Windows 10 中开发一个项目,我必须创建一个 docker 映像才能使用 DockerFile 运行 python 应用程序。我必须导入 pip、python 和库时间并请求我的应用程序运行。但是,当必须导入脚本依赖时间和请求时,在构建 Docker 映像时出现错误。 我的错误:
Could not find a version that satisfies the requirement time (from versions: )
No matching distribution found for time
You are using pip version 8.1.1, however version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
我的 Docker 文件:
FROM ubuntu:16.04
MAINTAINER name <vskentos1@gmail.com>
RUN apt-get update
RUN apt-get install -y python3 python3-pip
RUN pip3 install time requests
RUN mkdir /script //create new directory
COPY ex2.py /script //add python script in new directory
ENTRYPOINT ["python" , "/script/ex2.py"]
我尝试过的: 命令:
pip install --pip upgrade
我知道 pip 已安装到最新版本:
C:\Windows\system32>pip install --upgrade pip
Requirement already up-to-date: pip in c:\users\vasilis\anaconda3\envs\environment\lib\site-
packages (20.1.1)
但是,当导入时间库时,我的图像会出现相同的错误。 感谢您帮助指导我完成这项任务。 提前谢谢你。
【问题讨论】:
-
我认为你不需要(也不能,因为它不在 pypi 上)安装
time包。它是内置的:docs.python.org/3/py-modindex.html
标签: python docker pip dockerfile