Jet*_* C. 8 docker anaconda conda dockerfile docker-build
我可以dev1成功创建虚拟环境,但在 Docker 构建过程中无法激活它并切换到其中。
我想要的只是切换 venv 并将我的依赖项安装在requirements.txt.
我的代码:
WORKDIR /APP
ADD . /APP
ARG CONDA_VENV=dev1
RUN conda create -y --name ${CONDA_VENV} python=3.7
RUN conda activate ${CONDA_VENV}
RUN pip install -r requirements.txt
Run Code Online (Sandbox Code Playgroud)
错误:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
The command '/bin/sh -c conda activate ${CONDA_VENV}' returned a non-zero code: 1
Run Code Online (Sandbox Code Playgroud)
它必须在同一行。使用 pip安装dev1:
RUN . /code/miniconda/etc/profile.d/conda.sh && conda activate dev1\
&& pip install -r requirements.txt
Run Code Online (Sandbox Code Playgroud)
使用 conda 本身安装dev1coda 通道中的包
RUN conda install -n dev1 packagname
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2228 次 |
| 最近记录: |