sudo apt-get update连接失败问题解决

在安装python-pip时出现连接失败错误
sudo apt-get update连接失败问题解决_第1张图片
进而在执行sudo apt-get update是也出现连接失败错误,怀疑是源不可用:
sudo apt-get update连接失败问题解决_第2张图片
搜索得知如下解决方案:
1. 先关闭所有源
sudo apt-get update连接失败问题解决_第3张图片
2. rm -rf /var/lib/apt/lists/*删除/var/lib/apt/lists 所有文件
3. 修改/etc/apt/sources.list文件。将源改成163的或者阿里的:
(注意版本匹配:16.1->yakkety;16.04->xenial;15.10->willy;14.04->trusty;12.04->precise)

deb http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse

4.再次sudo apt-get update成功
sudo apt-get update连接失败问题解决_第4张图片

参考:
ubuntu sudo apt-get update 失败 解决方法
ubuntuapt-getupdate失败解决方案
ubuntu16.04更换为国内源

你可能感兴趣的:(Linux)