在 Ubuntu 16.04 上安装 R 时 Apt 未满足依赖关系

在 Ubuntu 16.04 上安装 R 时 Apt 未满足依赖关系

我想安装新版本的 R,所以我删除了所有 r-*,然后我不幸地破坏了一切。我尝试通过输入重新安装 R 项目

sudo apt install r-base r-base-core r-recommended

然后我得到

Reading package lists... Done  
Building dependency tree         
Reading state information... Done  
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

 The following packages have unmet dependencies.  
 r-base-core : Depends: libc6 (>= 2.27) but 2.23-0ubuntu11 is to be 
               installed  
               Depends: libcurl4 (>= 7.28.0) but it is not installable  
               Depends: libicu60 (>= 60.1-1~) but it is not installable  
               Depends: libreadline7 (>= 6.0) but it is not installable  
               Recommends: r-base-dev but it is not going to be installed  
E: Unable to correct problems, you have held broken packages.

有人知道如何解决这个问题吗?

答案1

我的问题解决了。

我在 sources.list 中输入了错误的来源来下载最新版本的 R。按照https://cloud.r-project.org/,我把 代替deb https://cloud.r-project.org/bin/linux/ubuntu cosmic-cran35/deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/

通过修改源代码,现在一切都正常了。

答案2

以下是如何在当前的 Ubuntu 发行版上安装 R 3.6,而无需手动调整发行版名称或

sudo apt-get update
sudo apt-get install -y apt-transport-https software-properties-common
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

# this will define the DISTRIB_* environment variables
source /etc/lsb-release

sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu ${DISTRIB_CODENAME}-cran35/"

# for 18.04, bionic beaver, this resolves to
#sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
# for 16.04, xenial, this resolves to
#sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/'

sudo apt-get update
sudo apt-get install -y r-base r-base-dev
R --version
Rscript --version

这应该可以消除由于您选择错误的分布而出现的错误消息,例如:

 The following packages have unmet dependencies.  
 r-base-core : Depends: libc6 (>= 2.27) but 2.23-0ubuntu11 is to be 
               installed  
               Depends: libcurl4 (>= 7.28.0) but it is not installable  
               Depends: libicu60 (>= 60.1-1~) but it is not installable  
               Depends: libreadline7 (>= 6.0) but it is not installable  
               Recommends: r-base-dev but it is not going to be installed  

灵感来自

答案3

尝试这个:

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install libc6 libcurl4 libicu60-dev libreadline7
sudo apt-get install r-base r-base-core r-recommended

相关内容