[英]How do I install tensorflow in a Docker image w/ venv?
我有以下代码...
FROM python:latest
ENV VIRTUAL_ENV "/venv"
RUN python -m venv $VIRTUAL_ENV
ENV PATH "$VIRTUAL_ENV/bin:$PATH"
# Python commands run inside the virtual environment
RUN /venv/bin/python3 -m pip install --upgrade pip
RUN /venv/bin/pip3 install tensorflow
但是当我跑步时,我得到...
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
我尝试使用 tensorflow 图像,例如...
FROM tensorflow/tensorflow:latest
ENV VIRTUAL_ENV "/venv"
RUN python -m venv $VIRTUAL_ENV
ENV PATH "$VIRTUAL_ENV/bin:$PATH"
# Python commands run inside the virtual environment
RUN /venv/bin/python3 -m pip install --upgrade pip
但后来我得到...
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt-get install python3-venv
所以我改成
FROM tensorflow/tensorflow:latest
RUN apt-get install python3-venv -y
ENV VIRTUAL_ENV "/venv"
RUN python -m venv $VIRTUAL_ENV
ENV PATH "$VIRTUAL_ENV/bin:$PATH"
# Python commands run inside the virtual environment
RUN /venv/bin/python3 -m pip install --upgrade pip
但我得到...
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/universe/p/python3.6/python3.6-venv_3.6.9-1~18.04ubuntu1.1_amd64.deb 404 Not Found [IP: 91.189.88.152 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
我该如何处理?
每@drum评论这有效......
FROM tensorflow/tensorflow:latest
RUN apt-get update && apt-get upgrade -y
RUN apt-get install python3-venv -y
ENV VIRTUAL_ENV "/venv"
RUN python -m venv $VIRTUAL_ENV
ENV PATH "$VIRTUAL_ENV/bin:$PATH"
# Python commands run inside the virtual environment
RUN /venv/bin/python3 -m pip install --upgrade pip
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.