小编Shr*_*sai的帖子

在 Docker 中配置/设置/激活 Python Conda 环境

我正在尝试在 docker 容器内设置 conda 环境,但它总是在 dockerfile 中的环境创建阶段失败,并出现错误: conda activate" fails because shell is not initialized

下面是我的 Dockerfile:

FROM pytorch/pytorch:1.1.0-cuda10.0-cudnn7.5-runtime

WORKDIR /app

# SET BASH AS CURRENT SHELL
RUN chsh -s /bin/bash
SHELL ["/bin/bash", "-c"]

# INSTALL ANACONDA
RUN apt-get update -y

RUN apt-get install -y wget && \
    apt-get clean


RUN rm -rf /opt/conda && \
    wget --quiet https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh -O ~/anaconda.sh && \
    /bin/bash ~/anaconda.sh -b -p /opt/conda && \
    rm ~/anaconda.sh && \
    ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \ …
Run Code Online (Sandbox Code Playgroud)

python docker anaconda

0
推荐指数
1
解决办法
4970
查看次数

标签 统计

anaconda ×1

docker ×1

python ×1