无法在 Ubuntu 18.04 Linux 上安装最新的 R 版本

无法在 Ubuntu 18.04 Linux 上安装最新的 R 版本

我希望能够为 Ubuntu 18.04 安装最新的稳定 R 版本,我安装了 ubuntu 版本,因此我将其删除,然后按照以下几个指南进行操作,例如关联。

无论我做什么,当我发出时都会得到以下输出sudo apt-get install r-base

sudo apt install r-base
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.1-3disco) but it is not going to be installed
          Depends: r-recommended (= 3.6.1-3disco) 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.

怎么了?(我做了所有的事情apt update等等。)

答案1

对于遇到同样问题的人,我找到了解决方案: 无法在 Ubuntu Bionic Beaver(18.04)中安装 R 3.5.0

我只需按顺序发出这些命令然后就可以安装:

  1. 暂时deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35//etc/apt/sources.list
  2. sudo apt-get autoremove sudo apt-get update sudo apt-get upgrade
  3. 已添加deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35//etc/apt/sources.list
  4. sudo apt-get update
  5. sudo apt-get install r-base

就是这样(安装 R 3.6.1)。

答案2

这个解决方案对我有用: https://linuxize.com/post/how-to-install-r-on-ubuntu-18-04/

  1. 安装通过 HTTPS 添加新存储库所需的软件包:

sudo apt install apt-transport-https software-properties-common

  1. 使用以下命令启用 CRAN 存储库并将 CRAN GPG 密钥添加到您的系统:

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

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

  1. 现在已添加 apt 存储库,请输入以下命令更新包列表并安装 R 包:

sudo apt update sudo apt install r-base

  1. 要验证安装是否成功,请运行以下命令,该命令将打印 R 版本:

R --version

相关内容