在安装python-pip时出现连接失败错误
进而在执行sudo apt-get update是也出现连接失败错误,怀疑是源不可用:
搜索得知如下解决方案:
1. 先关闭所有源
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成功
参考:
ubuntu sudo apt-get update 失败 解决方法
ubuntuapt-getupdate失败解决方案
ubuntu16.04更换为国内源