Ubuntu安装codeblocks碰到更新源列表失败

在Ubuntu系统中安装Codeblocks时遇到更新源列表失败的问题,尝试多种方法如修改dpkg info目录、使用应用商店安装均未成功。最终通过删除并备份两个文件恢复更新源,然后安装build-essential和gcc等依赖,成功安装了Codeblocks。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

查阅得知安装codeblocks执行如下命令

sudo add-apt-repository ppa:pasgui/ppa
sudo apt-get update
sudo apt-get install codeblocks

sudo apt-get update时出现如下报错:

N: See apt-secure(8) manpage for repository creation and user configuration details.

尝试 cd /var/lib/dpkg;sudo mv info info.bak;sudo mkdir info;sudo apt-get update 仍出现上述问题,遂尝试用ubuntu系统自带的应用商店安装也未能正常下载安装,直接卡死。
再次尝试手动下载官网程序20余兆,安装程序sudo dpkg -i codeblocks-contrib-dbg_16.01_ubuntu16.04.1_amd64.deb时出现错误部分如下:

dpkg: warning: files list file for package 'qmlscene' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libncurses5:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'baobab' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'hplip' missing; assuming package has no files currently installed

尝试如下三种方式均未能正常安装,

sudo apt-get -o Dpkg::Options::="--force-overwrite" -f install
sudo apt-get install --fix-missing
sudo apt-get install -f

最后决定还是先处理更新源列表问题,查阅得知,删除这两个文件,重新更新源即可

sudo rm -rf /var/lib/apt/lists/*
sudo rm -rf /etc/apt/sources.list.d/*
sudo apt-get update

为了防止出现更大的错误,两个文件备份后删除,更新源正常。
此时接着安装codeblocks,首先检查是否缺乏相关依赖执行

sudo apt install build-essential

出现如下提示:

codeblocks-contrib-dbg : Depends: codeblocks-contrib (= 16.01~ubuntu16.04.1) but it is not going to be installed
                         Depends: codeblocks-dbg (= 16.01~ubuntu16.04.1) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

按提示执行sudo apt-get -f installsudo apt install build-essential正常,
接着安装gcc,执行此命令 sudo apt-get install gcc ,最后安装 codeblocks
sudo apt-get install codeblocks即正常。

以上为个人笔记,其中的深层缘由暂未了解,其中的解决方法来源于网上各位大佬的解答分享和自己的推测和实践得来,若有不对的地方,请大家指教,谢谢

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值