在 Ubuntu 18.14 LTS 上安装 R 3.6.2 的未满足依赖项

Unmet dependencies installing R 3.6.2 on Ubuntu 18.14 LTS

我使用 18.04.4 LTS(仿生海狸)

我想将我的 R 版本从 3.4.4 升级到 3.6.2,但现在我根本没有 R。

这是我的操作:

1 步:

sudo apt update
sudo apt-get upgrade
sudo apt-get dist-upgrade

2 步:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

3 步:

sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'

return:

Hit:1 http://ua.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://ua.archive.ubuntu.com/ubuntu bionic-updates InRelease                     
Hit:3 http://ua.archive.ubuntu.com/ubuntu bionic-backports InRelease                   
Hit:4 http://cran.rstudio.com/bin/linux/ubuntu bionic-cran35/ InRelease                
Hit:5 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease                      
Hit:6 http://security.ubuntu.com/ubuntu bionic-security InRelease                      
Hit:7 https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/ InRelease
Hit:8 https://cloud.r-project.org/bin/linux/ubuntu disco-cran35/ InRelease
Hit:9 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ InRelease
Reading package lists... Done

4 步:

sudo apt update
sudo apt install r-base

return:

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 : Depends: r-base-core (>= 3.6.2-1xenial) but it is not going to be installed
      Depends: r-recommended (= 3.6.2-1xenial) but it is not going to be installed
      Recommends: r-base-html but it is not going to be installed
 E: Unable to correct problems, you have held broken packages.

那我试试:

R --version

return:

Command 'R' not found, but can be installed with:
sudo apt install r-base-core

我试试:

 sudo apt install r-base-core


 The following packages have unmet dependencies:
  r-base-core : Depends: libreadline6 (>= 6.0) but it is not 
  installable
           Recommends: r-recommended but it is not going to be 
  installed
           Recommends: r-base-dev but it is not going to be 
  installed
  E: Unable to correct problems, you have held broken packages.

您可以尝试两件事:

  1. 因为你好像已经安装好了,刚到sudo apt-get dist-upgrade。它会列出候选升级,你仍然可以退出。优点:为你解决了相互依赖的升级。

  2. 继续您所做的,但列出受影响的包,即 sudo apt-get install r-base r-recommended r-base-hmtml。这会起作用,但可能需要几个迭代步骤。

我查看了 etc/apt/sources.list 文件,发现我重复了相同的存储库。我删除了两行,问题就解决了。