在国内使用pip安装超级慢,如何解决呢?

核心代码:

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

如果单独安装某个 使用源加参数的形式:-i,比如:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U

如果根据ubuntu16.04使用dockerfile安装tensorflow的时候下载还是很慢怎么办?

我们可以先下载Anaconda3.sh,然后再下载tensorflow.whl文件安装,如图

ADD Anaconda3-5.2.0-Linux-x86_64.sh /opt/
RUN bash /opt/Anaconda3-5.2.0-Linux-x86_64.sh -b -p /usr/local/anaconda3 && rm  /opt/Anaconda3-5.2.0-Linux-x86_64.sh
# RUN wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh -O ~/anaconda3.sh
# RUN bash ~/anaconda3.sh -b -p /usr/local/anaconda3 \
#                    && rm ~/anaconda3.sh
ENV PATH /usr/local/anaconda3/bin:$PATH
# update repo
RUN sh -c echo -e "y\n" | conda update conda
RUN pip install --upgrade pip
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# install tensorflow
# RUN pip install --upgrade tensorflow
ADD tensorflow-2.3.0-cp37-cp37m-manylinux2010_x86_64.whl /opt/
RUN pip install --upgrade /opt/tensorflow-2.3.0-cp37-cp37m-manylinux2010_x86_64.whl