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

Ubuntu安装python3-pip遇安全验证失败及404资源获取错误

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

问题现象

执行sudo apt install python3-pip时出现大量404错误,同时提示部分包无法验证,完整错误输出如下:

xc@xc:~$ sudo apt install python3-pip
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libexpat1-dev libjs-jquery libjs-sphinxdoc libjs-underscore libpython3-dev libpython3.9-dev
  python-pip-whl python3-dev python3-distutils python3-setuptools python3-wheel python3.9-dev
  zlib1g-dev
Suggested packages:
  python-setuptools-doc
The following NEW packages will be installed:
  libexpat1-dev libjs-jquery libjs-sphinxdoc libjs-underscore libpython3-dev libpython3.9-dev
  python-pip-whl python3-dev python3-distutils python3-pip python3-setuptools python3-wheel
  python3.9-dev zlib1g-dev
0 upgraded, 14 newly installed, 0 to remove and 2 not upgraded.
Need to get 8,653 kB of archives.
After this operation, 29.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
WARNING: The following packages cannot be authenticated!
  libjs-jquery libjs-underscore libjs-sphinxdoc libpython3-dev python-pip-whl python3-distutils
  python3-dev python3-setuptools python3-wheel python3-pip
Install these packages without verification? [y/N] y

Err:1 http://security.ubuntu.com/ubuntu impish-security/main amd64 libexpat1-dev amd64 2.4.1-2ubuntu0.3
  404  Not Found [IP: 2620:2d:4000:1::19 80]
Ign:2 http://in.archive.ubuntu.com/ubuntu impish/main amd64 libjs-jquery all 3.5.1+dfsg+~3.5.5-7 
Err:3 http://security.ubuntu.com/ubuntu impish-security/main amd64 zlib1g-dev amd64 1:1.2.11.dfsg-2ubuntu7.1
  404  Not Found [IP: 2620:2d:4000:1::19 80]
Ign:4 http://in.archive.ubuntu.com/ubuntu impish/main amd64 libjs-underscore all 1.9.1~dfsg-3
Ign:5 http://in.archive.ubuntu.com/ubuntu impish/main amd64 libjs-sphinxdoc all 3.5.4-2
Err:6 http://security.ubuntu.com/ubuntu impish-security/main amd64 libpython3.9-dev amd64 3.9.7-2ubuntu0.1
  404  Not Found [IP: 2620:2d:4000:1::19 80]
Err:7 http://security.ubuntu.com/ubuntu impish-security/main amd64 python3.9-dev amd64 3.9.7-2ubuntu0.1
  404  Not Found [IP: 2620:2d:4000:1::19 80]
Err:8 http://in.archive.ubuntu.com/ubuntu impish/main amd64 libpython3-dev amd64 3.9.4-1build1
  404  Not Found [IP: 2620:2d:4000:1::16 80]
Ign:9 http://in.archive.ubuntu.com/ubuntu impish/universe amd64 python-pip-whl all 20.3.4-4
Ign:10 http://in.archive.ubuntu.com/ubuntu impish/main amd64 python3-distutils all 3.9.7-1
Err:11 http://in.archive.ubuntu.com/ubuntu impish/main amd64 python3-dev amd64 3.9.4-1build1
  404  Not Found [IP: 2620:2d:4000:1::16 80]
Ign:12 http://in.archive.ubuntu.com/ubuntu impish/main amd64 python3-setuptools all 52.0.0-4
Get:13 http://in.archive.ubuntu.com/ubuntu impish/universe amd64 python3-wheel all 0.34.2-1 [23.8 kB]
Ign:14 http://in.archive.ubuntu.com/ubuntu impish/universe amd64 python3-pip all 20.3.4-4
Err:2 http://in.archive.ubuntu.com/ubuntu impish/main amd64 libjs-jquery all 3.5.1+dfsg+~3.5.5-7
  404  Not Found [IP: 2620:2d:4000:1::16 80]
Err:4 http://in.archive.ubuntu.com/ubuntu impish/main amd64 libjs-underscore all 1.9.1~dfsg-3
  404  Not Found [IP: 2620:2d:4000:1::16 80]
Err:5 http://in.archive.ubuntu.com/ubuntu impish/main amd64 libjs-sphinxdoc all 3.5.4-2
  404  Not Found [IP: 2620:2d:4000:1::16 80]
Err:9 http://in.archive.ubuntu.com/ubuntu impish/universe amd64 python-pip-whl all 20.3.4-4
  404  Not Found [IP: 2620:2d:4000:1::16 80]
Err:10 http://in.archive.ubuntu.com/ubuntu impish/main amd64 python3-distutils all 3.9.7-1
  404  Not Found [IP: 2620:2d:4000:1::16 80]
Err:12 http://in.archive.ubuntu.com/ubuntu impish/main amd64 python3-setuptools all 52.0.0-4
  404  Not Found [IP: 2620:2d:4000:1::16 80]
Err:14 http://in.archive.ubuntu.com/ubuntu impish/universe amd64 python3-pip all 20.3.4-4
  404  Not Found [IP: 2620:2d:4000:1::16 80]
Fetched 23.8 kB in 3s (8,811 B/s)
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/e/expat/libexpat1-dev_2.4.1-2ubuntu0.3_amd64.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/n/node-jquery/libjs-jquery_3.5.1%2bdfsg%2b%7e3.5.5-7_all.deb  404  Not Found [IP: 2620:2d:4000:1::16 80]
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/u/underscore/libjs-underscore_1.9.1%7edfsg-3_all.deb  404  Not Found [IP: 2620:2d:4000:1::16 80]
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/s/sphinx/libjs-sphinxdoc_3.5.4-2_all.deb  404  Not Found [IP: 2620:2d:4000:1::16 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/z/zlib/zlib1g-dev_1.2.11.dfsg-2ubuntu7.1_amd64.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python3.9/libpython3.9-dev_3.9.7-2ubuntu0.1_amd64.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/p/python3-defaults/libpython3-dev_3.9.4-1build1_amd64.deb  404  Not Found [IP: 2620:2d:4000:1::16 80]
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/universe/p/python-pip/python-pip-whl_20.3.4-4_all.deb  404  Not Found [IP: 2620:2d:4000:1::16 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python3.9/python3.9-dev_3.9.7-2ubuntu0.1_amd64.deb  404  Not Found [IP: 2620:2d:4000:1::19 80]
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/p/python3-stdlib-extensions/python3-distutils_3.9.7-1_all.deb  404  Not Found [IP: 2620:2d:4000:1::16 80]
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/p/python3-defaults/python3-dev_3.9.4-1build1_amd64.deb  404  Not Found [IP: 2620:2d:4000:1::16 80]
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/s/setuptools/python3-setuptools_52.0.0-4_all.deb  404  Not Found [IP: 2620:2d:4000:1::16 80]
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/universe/p/python-pip/python3-pip_20.3.4-4_all.deb  404  Not Found [IP: 2620:2d:4000:1::16 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

问题根源

你的Ubuntu版本是21.10(Impish Indri),这个版本已达到生命周期终点,官方停止了所有支持,包括软件包更新和安全补丁。官方源(security.ubuntu.com、in.archive.ubuntu.com)已移除该版本的所有包,因此出现404错误;包无法验证是因为源失效,无法获取用于验证包签名的文件。

解决方案

方案1:升级到受支持的Ubuntu版本(推荐)

停止支持的版本不会收到安全补丁,存在安全风险,因此优先推荐升级:

  1. 清理旧缓存:
    sudo apt update --fix-missing
    
  2. 运行版本升级工具:
    sudo do-release-upgrade
    
  3. 按照屏幕提示完成升级,建议选择长期支持版本(LTS),比如22.04 LTS或24.04 LTS。
  4. 升级完成后,执行以下命令安装python3-pip:
    sudo apt update
    sudo apt install python3-pip
    

方案2:使用旧版本归档源(临时方案,不推荐)

如果暂时无法升级,可将源替换为Ubuntu旧版本归档源,但此源不再提供安全更新,仅能解决包安装问题:

  1. 备份原有源文件:
    sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
    
  2. 替换源内容:
    sudo tee /etc/apt/sources.list <<EOF
    deb http://old-releases.ubuntu.com/ubuntu/ impish main restricted universe multiverse
    deb http://old-releases.ubuntu.com/ubuntu/ impish-updates main restricted universe multiverse
    deb http://old-releases.ubuntu.com/ubuntu/ impish-security main restricted universe multiverse
    EOF
    
  3. 更新源缓存:
    sudo apt update
    
  4. 安装python3-pip:
    sudo apt install python3-pip
    

注意:使用归档源后,系统将无法获取任何安全更新,建议尽快升级到受支持的版本。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.20 17:45:47