Ubuntu12.0安装g++过程及其报错

1、安装g++

sudo apt-get install g++

2、报错一:没有这个安装包
解决:换源
①备份,修改源

 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak 
 sudo gedit /etc/apt/sources.list 

②将sources.list的内容全选替换为以下内容

				deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
                deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
                deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
                deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
                deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
                deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
                deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
                deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
                deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
                deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse 

③更新本地源列表

sudo apt-get update 

参考链接:
https://blog.csdn.net/qq_36396104/article/details/79748458
⭐如果出现没有以下公钥报错:
在这里插入图片描述
解决:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 3B4FE6ACC0B21F32

在这里插入图片描述
参考链接:
https://blog.csdn.net/qq_41072096/article/details/104680461

3、报错二:command-not-found has crashed
解决:

export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
sudo dpkg-reconfigure locales

参考链接:
https://blog.csdn.net/weixin_34279246/article/details/92472225
4、报错三:Unment dependencies. Try ‘apt-get -f install’ with no packages
解决:

sudo apt-get -f install
sudo apt-get update
sudo apt-get upgrade
sudo apt-get update
sudo apt-get clean
sudo apt-get autoremove
sudo apt --fix-broken install
sudo apt-get update && sudo apt-get upgrade
sudo dpkg --configure -a
sudo apt-get install -f

参考链接:
https://cloud.tencent.com/developer/article/1671540
5、所有错误解决后再执行安装

udo apt-get install g++

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值