You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 22.04中Python3-pip安装多次失败,遇404错误求助

Ubuntu 22.04安装python3-pip失败的解决办法

问题描述

在Ubuntu 22.04中多次尝试安装python3-pip均失败,报错核心为无法获取libexpat1-dev包,具体报错信息:

Err:1 http://security.ubuntu.com/ubuntu jammy-updates/main amd64 libexpat1-dev amd64 2.4.7-1ubuntu0.2
404  Not Found [IP: 185.125.190.39 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/e/expat/libexpat1-dev_2.4.7-1ubuntu0.2_amd64.deb  404  Not Found [IP: 185.125.190.39 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

解决步骤

  • 先更新本地软件源缓存,执行命令:

    sudo apt update
    

    本地缓存的软件包版本信息可能已过期,更新后会同步服务器最新的包索引。

  • 更新缓存后重新尝试安装,加上--fix-missing参数修复缺失的包:

    sudo apt install python3-pip --fix-missing
    
  • 若上述方法无效,更换国内镜像源(以清华镜像为例):

    1. 备份原有源文件:
      sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
      
    2. 编辑源文件:
      sudo nano /etc/apt/sources.list
      
    3. 将文件内容替换为清华Ubuntu 22.04(jammy)镜像源:
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
      deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
      
    4. 按Ctrl+O保存,Ctrl+X退出编辑器,再次执行更新和安装命令:
      sudo apt update
      sudo apt install python3-pip
      

内容的提问来源于stack exchange,提问作者Victor Ubi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 18:43:33