问题描述
在使用Windows 10的Linux子系统时,写了一个hello world的c文件,发现不能编译提示的是:Command ‘gcc’ not found, but can be installed with: sudo apt install gcc
提示’gcc’命令没有安装,按提示输入
$ sudo apt install gcc
之后提示是否继续,输入y回车
之后报错
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
解决方法
Error报的信息显示是这个包向source里的资源下载失败了。从而得出是网络的问题。
网关错误拦截了数据包或者防火墙故意将其屏蔽在外(比方update 包含有google-chrome浏览器的source时候,ip 会自动重定向至6.6.6.6)
然后在命令行输入
sudo vi /etc/resolv.conf
添加
nameserver 8.8.8.8
nameserver 223.5.5.5
nameserver 223.6.6.6
保存退出后再运行
$ sudo apt install gcc
下载成功