在DOCKERFILE中给python换源

FROM python:3.x下插入:

RUN mkdir ~/.pip && \
    echo "[global]\nindex-url = https://mirrors.aliyun.com/pypi/simple/\ntrusted-host = mirrors.aliyun.com" > ~/.pip/pip.conf

如果是在本机换源可以在~/.pip/pip.conf 中写入:

[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com

猜你喜欢

转载自blog.csdn.net/qq_41575489/article/details/131184880