解决Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

ubuntu上使用安装 pip 时,命令: sudo apt-get install python3-pip 显示错误:

Unable to fetch some archives, maybe run apt-get update or try with --fix-missing
  1. 按照报错提示进行sudo apt-get update (--fix-missing) ,并没有解决,仍出现相同问题;
  2. 判断是否为网络屏蔽问题:ping www.baidu.com 如果能 ping 通,说明 DNS 正常;如果无法 ping 通,则进入 sudo vim /etc/resolv.conf,在最后加入
nameserver 8.8.8.8
nameserver 223.5.5.5
nameserver 223.6.6.6

继续尝试安装 pip,依然失败;

  3. 此时为 source 本身的问题,需要更新源,进入sudo vim /etc/apt/sources.list,将内容修改为

# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

(为了确保可使用,可先在浏览器中试用几个ip地址是否可以正常访问),地址更换可参见该博主的文章:https://blog.51cto.com/sunway/1243648

 最后执行命令 `sudo apt-get update` 更新软件列表

posted on 2022-06-21 11:08  阳光雨露&  阅读(5982)  评论(0编辑  收藏  举报

导航