【问题标题】:How to run docker with specific apps version?如何使用特定应用程序版本运行 docker?
【发布时间】:2023-04-04 23:11:01
【问题描述】:

我在 python 中使用 docker,当我需要安装一些特定版本的应用程序时,我 docker 仍然是我:

 => ERROR [3/3] RUN pip install cx-Oracle == 7.0.0 pandas == 1.1.2    

我在 Dockerfile 中的代码:

# Dockerfile, Image, Container

From python:3.7.9

ADD main.py .

Run pip install cx-Oracle == 7.0.0 pandas == 1.1.2

CMD ["python","./main.py"]

【问题讨论】:

    标签: python docker pip dockerfile dockerpy


    【解决方案1】:

    这与 docker 无关。 pip install 只是不喜欢包名和版本之间有空格。

    如果你直接在终端尝试pip install nonexistingpackage == 1.0.0,你会在pip之前得到错误Invalid requirement: '==',甚至检查包nonexistingpackage是否存在。

    原因是pip install 使用空格作为不同包之间的分隔符。

    删除空格:

    RUN pip install cx-Oracle==7.0.0 pandas==1.1.2
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-10-31
      • 2014-04-06
      • 1970-01-01
      • 2021-05-11
      • 1970-01-01
      • 1970-01-01
      • 2020-07-27
      相关资源
      最近更新 更多