ubuntu安装最新版R语言教程-解决依赖问题

最近在ubuntu 18的版本上安装R,然后R官网(https://cran.r-project.org/bin/linux/ubuntu/README.html
)教的方法安装不上。按照官网的步骤操作后使用以下命令后报错,本人在网上没有找到人回答这个问题,自己分享一下自己的经验,希望对大家有帮助。

[11:25:25 root@DESKTOP-ODDKJ55:/root]## sudo apt-get update
[11:25:25 root@DESKTOP-ODDKJ55:/root]## sudo apt-get 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-core : Depends: libc6 (>= 2.29) but 2.27-3ubuntu1 is to be installed
               Depends: libgomp1 (>= 4.9) but it is not going to be installed
               Depends: libicu63 (>= 63.1-1~) but it is not installable
               Depends: liblapack3 but it is not going to be installed or
                        liblapack.so.3
               Depends: libreadline8 (>= 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
               Recommends: r-doc-html but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

目前已经解决,分享自己的安装步骤:

  1. 第一步:按照官网在更新 /etc/apt/sources.list 文件。本人使用的是第一个:
 deb https://cloud.r-project.org/bin/linux/ubuntu disco-cran35/
  1. 第二步:添加密钥(官网把这个放在下面),-如果没有执行这个,按照官网上直接用sudo apt-get install update会报错-
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
  1. 第三步(也许不是):官网第三步是两个命令,第一个命令不确定需不需要,此步骤也许完全不需要
sudo apt-get update # 这个命令不确定对conda安装有没有影响,执行一下没坏处
sudo apt-get install r-base # 这条命令安装报错,详细报错信息可见文本最开始处
  1. 第三步(这个或许是真正的第三步):使用apt-get install安装会一直让你安装各种依赖包,然后依赖包还有依赖包,使用conda完美解决依赖问题(Anaconda安装教程太多了,自己搜搜就好),但是如果没有在 /etc/apt/sources.list文件中更新源,安装的是R的3.2.2(好像是这个)版本,要安装最新的版本,到官网去找最新的源。上面两步操作的意义就是更新源,确定更新之后使用一下命令安装R
 conda install R
  1. conda安装会问你yes or no的问题,yes就行。安装完后输入R,完美进入R。
[11:52:16 root@DESKTOP-ODDKJ55:/root]# R
R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-conda_cos6-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 

你可能感兴趣的:(ubuntu安装最新版R语言教程-解决依赖问题)