在Ubuntu中安装某些东西时,报错
Package pkg-config is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'pkg-config' has no installation candidate
这个报错是Ubuntu中的源过于老旧,需要换成新的镜像站
1、查看目前Ubuntu源网址
sudo nano /etc/apt/sources.list
上图是中科大的源网址,可以通过更换成阿里云,清华,浙大的源网址去解决,也可以直接更新目前源网址去解决
常见的镜像站有:
http://mirrors.163.com/ubuntu/
http://mirror.lzu.edu.cn/ubuntu/
http://mirrors.ustc.edu.cn/ubuntu/
http://mirror.neu.edu.cn/ubuntu/
http://mirrors.aliyun.com/ubuntu/
2.1、更换镜像站
在命令行中输入
sudo sed -i 's/cn\.mirrors\.aliyun\.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/backports.list
上述命令行执行的是将阿里云的镜像站,换成中科大的镜像站,前者是你目前的镜像站,后者是你想要替换成的镜像站
2.2、更新镜像站
与2.1效果相同,两次操作只做一次即可
在命令行中输入
sudo apt-get -y update
3、更新apt-get
在命令行中输入
sudo apt-get update