docker - 激活 conda env 并在 Dockfile 中运行 pip install 要求
问题描述
我可以成功创建我的虚拟环境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
错误:
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
解决方案
推荐阅读
- python - 将多个张量成对相乘 keras
- jquery - bootstrap4C 有延时改函数没功能?
- c# - C# 禁用 USB ReadPipe 的垃圾收集
- python - 获取图像的轮廓和点
- google-analytics - 生成以周为单位的内容深入分析报告
- javascript - 在焦点自动选项卡 java 脚本中删除只读属性
- postgresql - Google Cloud '导入失败:错误:编码“UTF8”的字节序列无效:0xff 导入错误:退出状态 3'
- c++ - 如何使用成员函数将整数数组返回到动态整数数组
- python - 重用两个 MapReduce 作业的输出并将结果连接在一起
- python - 在 Windows 中更改 Python 路径