51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

dockerfile 配置 Python源

dockerfile中设置pip源

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

还有几种方法:

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
赞(1)
未经允许不得转载:工具盒子 » dockerfile 配置 Python源