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

Ubuntu环境下无法安装command-not-found包的问题求助

解决Ubuntu上安装command-not-found相关包的问题

为什么pip安装command-not-found==0.3失败

command-not-found==0.3这个版本并未在PyPI上发布,或是已被移除。你可以尝试不指定版本安装(如果仍有可用版本的话):

pip install command-not-found

但实际上,command-not-found作为Ubuntu系统自带的命令补全工具,通常是通过系统包管理器分发的,pip渠道的版本维护极不活跃,甚至可能已被废弃。

解决apt安装包找不到的问题

Ubuntu上的command-not-found工具,包名随Python版本和Ubuntu版本有差异:

  • 仅针对Ubuntu 18.04及更早的Python 2环境:包名为python-commandnotfound
  • 针对Ubuntu 20.04+的主流Python 3环境:包名为python3-commandnotfound

根据你的系统版本执行对应安装命令:

# 主流Ubuntu版本(Python3环境)
sudo apt install python3-commandnotfound

如果依然找不到包,先确认universe仓库是否启用(该工具属于universe源):

sudo add-apt-repository universe
sudo apt update

之后再重新执行安装命令即可。

GitHub Actions环境中的处理方式

在GitHub Actions的Ubuntu runner上,需要先启用universe仓库再安装,示例步骤:

- name: Install command-not-found
  run: |
    sudo add-apt-repository universe
    sudo apt update
    sudo apt install -y python3-commandnotfound

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.05 00:42:02