原创

apt-get更换国内源,python3-pip更换国内源

1.使用清华源
  1. 地址 https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/ 选择自己的的系统版本

2.查看系统版本

cat /etc/issue
2.替换sources.list

备份默认源

cp /etc/apt/sources.list /etc/apt/sources_init.list

18.04LTS版本的sources.list。覆盖写入/etc/apt/sources.list即可

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释,其中镜像地址https报错就改成http
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

3.python3-pip更换源

临时更换

pip3 install -r /app/requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
正文到此结束
本文目录