我正在尝试使用tensorflow基于官方的anaconda图像创建图像,以便我可以运行jupyter并从中导入tensorflow。我已经尝试了该过程的几种排列方式
https://docs.anaconda.com/anaconda/user-guide/tasks/tensorflow/
https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/install.html
https://github.com/conda/conda/issues/7980
但是我一直都在激活tensorflow环境来解决这个问题。
我的Dockerfile
FROM continuumio/anaconda3
RUN apt update
RUN apt -y upgrade
RUN apt -y install python3-dev python3-pip
RUN pip3 install -U virtualenv
RUN pip install --upgrade pip
RUN pip install pillow
RUN conda update -n base -c defaults conda
RUN conda create -n tf tensorflow pip python=3.6
运行命令
source ./settings.sh
docker stop mdsdev
docker rm mdsdev
docker run -t -p 8888:8888 \
--name mdsdev \
-v "$NOTEBOOKS_PATH_LOCAL":"$NOTEBOOKS_PATH" \
continuumio/anaconda3 \
/bin/bash -c \
"
/opt/conda/bin/conda init bash && \
/opt/conda/bin/conda activate tf && \
/opt/conda/bin/conda install jupyter -y --quiet && \
/opt/conda/bin/jupyter notebook --notebook-dir=$NOTEBOOKS_PATH --ip='0.0.0.0' --port=8888 --no-browser --allow-root"
运行输出
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'.