Ubuntu18.10解决libgtk安装问题

原来是apt源的问题

Posted by 婷 on March 23, 2020 本文总阅读量

问题

Ubuntu18.10下安装bochs的时候出现了这个错误,提示没有安装libgtk2.0-dev的问题

1.png

输入

sudo apt-get install libgtk2.0-dev

仍然无法安装,命令行提示很多依赖需要改变跟安装,自己手动安装后还是无法解决问题,上网搜索了很多博客也没找到解决问题的方法,最后是猜测是不是软件源的问题才发现自己长久以来使用的源跟我的Ubuntu18.10版本不对应……

方案

问题根源

输入命令,查看自己的Ubuntu版本跟对应的代号

sudo lsb_release -a

2.png

可以发现我的Ubuntu18.10对应的代号叫做cosmic

而下面是我之前的源,却是xenial,是16.04版本的…….(我用了这么久竟然没事)

deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse

问题解决

去中科大的官网,可以看到这里有个帮忙配置源的地方

3.png

点击进去然后选择Ubuntu源帮助

4.png

进去后就会发现有很多详细的文档说明跟文档链接,在这里就不罗列了,主要说说这里,原来Ubuntu18.10Ubuntu不再支持的版本了……

5.png

另外,中科大还提供了一个软件源配置生成器真的很良心了

6.png

最终改回来后的软件源如下

deb https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-proposed main restricted universe multiverse

换回来后sudo apt-get update一下,就可以顺利的执行sudo apt-get install libgtk2.0-dev命令啦

7 .png