【问题标题】:unable to copy python script dependencies in DockerFile无法在 DockerFile 中复制 python 脚本依赖项
【发布时间】: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)

但是,当导入时间库时,我的图像会出现相同的错误。 感谢您帮助指导我完成这项任务。 提前谢谢你。

【问题讨论】:

标签: python docker pip dockerfile


【解决方案1】:

这个模块好像已经安装在python版本中了。删除它的安装使我的程序运行

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-12-19
    • 1970-01-01
    • 2020-05-16
    • 2023-02-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多