尝试安装 build-essential 时出现“No Installation Candidate”

Dav*_*rry 10 apt

apt-get install build-essential 失败并出现以下错误:

~$ sudo apt-get install build-essential
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package build-essential 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 'build-essential' has no installation candidate
Run Code Online (Sandbox Code Playgroud)

sudo apt-get update在尝试此安装之前,我刚刚运行。

文件夹 /etc/apt/sources.list.d 是空的。这是 /etc/apt/sources.list 的主要内容:

$ grep deb\ http: /etc/apt/sources.list  #(with "deb http://" deleted)  
us.archive.ubuntu.com/ubuntu/ raring main restricted  
us.archive.ubuntu.com/ubuntu/ raring-updates main restricted  
us.archive.ubuntu.com/ubuntu/ raring universe  
us.archive.ubuntu.com/ubuntu/ raring-updates universe  
us.archive.ubuntu.com/ubuntu/ raring multiverse  
us.archive.ubuntu.com/ubuntu/ raring-updates multiverse  
us.archive.ubuntu.com/ubuntu/ raring-backports main restricted universe multiverse  
security.ubuntu.com/ubuntu raring-security main restricted  
security.ubuntu.com/ubuntu raring-security universe  
security.ubuntu.com/ubuntu raring-security multiverse  
extras.ubuntu.com/ubuntu raring main  
Run Code Online (Sandbox Code Playgroud)

这与 ubuntu 13.04 64 位。

apt-cache policy build-essential 
build-essential:
 Installed: (none)
 Candidate: (none)
 Version table: 
Run Code Online (Sandbox Code Playgroud)

目录 /etc/apt/sources.list.d 是空的。

Dav*_*rry 10

问题解决了。在 Ubuntu 软件中心 >> 编辑 >> 软件源中,我将服务器更改为主服务器,然后运行sudo apt-get update. 然后sudo apt-get install build-essential 哪个有效。