Dockerfile中 使用pip镜像源加速下载

用dockerfile文件制作镜像,提高pip下载速度

1 安装pip3,python3

RUN apt-get update
RUN apt-get install -y python3.5  
RUN apt-get install -y python3-pip 

2 更新pip,至最新

RUN pip3 install pip -U

3 配置阿里源

RUN pip3 config set global.index-url http://mirrors.aliyun.com/pypi/simple
RUN pip3 config set install.trusted-host mirrors.aliyun.com

注意:如想要使用别的镜像源,则直接替换index-url后的内容

4 安装python包

RUN pip3 install -r ./requirements.txt

猜你喜欢

转载自blog.csdn.net/xin_IT_able/article/details/102840470