在 Ubuntu 18.04 上安装 R 的问题

在 Ubuntu 18.04 上安装 R 的问题

我有这个版本的Ubuntu

Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:    18.04
Codename:   bionic

在我的计算机上与 Windows 进行双重启动。

我尝试按照本教程安装 Rhttps://www.digitalocean.com/community/tutorials/how-to-install-r-on-ubuntu-18-04我收到以下错误:

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-1bionic) but it is not going to be installed
          Depends: r-recommended (= 3.6.2-1bionic) 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.

为了修复错误,我遵循了这个答案https://askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependency-after-adding-a-ppa但所提出的解决方案都不起作用。

特别是,即使我sudo apt-get -f install回来了0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.,如果我再试一次,sudo apt install r-base 它仍然不起作用

答案1

我今天也遇到了类似的问题,我找到了解决方案,所以我想把我的经验分享给你。

我需要更新到 r 3.6,我使用的是 ubuntu 18。我首先删除了 R。我使用

sudo apt remove r-base. 

R 3.4 已从我的计算机中删除,但旧的依赖项仍被保留。当我按照 digitalocean 上的说明添加新存储库时https://www.digitalocean.com/community/tutorials/how-to-install-r-on-ubuntu-18-04-quickstart输入后我得到了同样的错误

sudo apt install r-base

问题是旧的依赖关系。我运行这个命令来解决这个问题

sudo apt-get -u dist-upgrade

我点击“Y”以批准删除旧的依赖项并批准安装新的依赖项。 *****关键是完成后关闭此终端,并在尝试再次安装 R 之前打开一个新终端。请记住,当您进行这样的系统更改时,它们不会立即在您的终端中实施,因此即使您解决了问题,该修复也不会应用于您当前的终端。因此,只需打开一个新终端,然后尝试安装 R。

祝你好运!

相关内容