Ubuntu 16.04 安装R和RStudio

在Ubuntu上安装R和Rstudio的时候碰到了一些依赖项不存在的错误

The following packages have unmet dependencies:
r-base-core : Depends: libc6 (>= 2.27) but 2.23-0ubuntu10 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: liblapack3 but it is not going to be installed or
liblapack.so.3
Depends: libreadline7 (>= 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.

看着像依赖项冲突

apt命令其实不能很好处理冲突的情况, 最好使用aptitude

sudo apt-get install aptitude

sudo aptitude install r-base

会提示哪些包出现来冲突

nstalled.
libicu-dev : Depends: libicu55 (= 55.1-7) but 55.1-7ubuntu0.4 is installed.
The following actions will resolve these dependencies:

Keep the following packages at their current version:
1) gfortran [Not Installed]
2) gfortran-5 [Not Installed]
3) libblas-dev [Not Installed]
4) libgfortran-5-dev [Not Installed]
5) libgfortran3 [Not Installed]
6) libicu-dev [Not Installed]
7) libjpeg-dev [Not Installed]
8) libjpeg-turbo8-dev [Not Installed]
9) libjpeg8-dev [Not Installed]
10) liblapack-dev [Not Installed]
11) liblapack3 [Not Installed]
12) libpng12-dev [Not Installed]
13) r-base [Not Installed]

,以及有哪些方案

扫描二维码关注公众号,回复: 3416627 查看本文章

Accept this solution? [Y/n/q/?] .
The following actions will resolve these dependencies:

Keep the following packages at their current version:
1) libjpeg-dev [Not Installed]
2) libjpeg-turbo8-dev [Not Installed]
3) libjpeg8-dev [Not Installed]
4) r-base-dev [Not Installed]

Downgrade the following packages:
5) cpp-5 [5.4.0-6ubuntu1~16.04.10 (now) -> 5.3.1-14ubuntu2 (xenial)]
6) g++-5 [5.4.0-6ubuntu1~16.04.10 (now) -> 5.3.1-14ubuntu2 (xenial)]
7) gcc-5 [5.4.0-6ubuntu1~16.04.10 (now) -> 5.3.1-14ubuntu2 (xenial)]
8) gcc-5-base [5.4.0-6ubuntu1~16.04.10 (now) -> 5.3.1-14ubuntu2 (xenial)]
9) libasan2 [5.4.0-6ubuntu1~16.04.10 (now) -> 5.3.1-14ubuntu2 (xenial)]
10) libatomic1 [5.4.0-6ubuntu1~16.04.10 (now) -> 5.3.1-14ubuntu2 (xenial)]
11) libcc1-0 [5.4.0-6ubuntu1~16.04.10 (now) -> 5.3.1-14ubuntu2 (xenial)]
12) libcilkrts5 [5.4.0-6ubuntu1~16.04.10 (now) -> 5.3.1-14ubuntu2 (xenial)]
13) libgcc-5-dev [5.4.0-6ubuntu1~16.04.10 (now) -> 5.3.1-14ubuntu2 (xenial)]
14) libgomp1 [5.4.0-6ubuntu1~16.04.10 (now) -> 5.3.1-14ubuntu2 (xenial)]
15) libicu55 [55.1-7ubuntu0.4 (now) -> 55.1-7 (xenial)]
16) libitm1 [5.4.0-6ubuntu1~16.04.10 (now) -> 5.3.1-14ubuntu2 (xenial)]
17) liblsan0 [5.4.0-6ubuntu1~16.04.10 (now) -> 5.3.1-14ubuntu2 (xenial)]
18) libmpx0 [5.4.0-6ubuntu1~16.04.10 (now) -> 5.3.1-14ubuntu2 (xenial)]
19) libpng12-0 [1.2.54-1ubuntu1.1 (now) -> 1.2.54-1ubuntu1 (xenial)]
20) libquadmath0 [5.4.0-6ubuntu1~16.04.10 (now) -> 5.3.1-14ubuntu2 (xenial)]
21) libstdc++-5-dev [5.4.0-6ubuntu1~16.04.10 (now) -> 5.3.1-14ubuntu2 (xenia
22) libstdc++6 [5.4.0-6ubuntu1~16.04.10 (now) -> 5.3.1-14ubuntu2 (xenial)]
23) libtsan0 [5.4.0-6ubuntu1~16.04.10 (now) -> 5.3.1-14ubuntu2 (xenial)]
24) libubsan0 [5.4.0-6ubuntu1~16.04.10 (now) -> 5.3.1-14ubuntu2 (xenial)]

Leave the following dependencies unresolved:
25) r-base-core recommends r-base-dev

 解决冲突后即可安装成功

在shell里输入R,提示成功

R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

猜你喜欢

转载自www.cnblogs.com/miwtony/p/9727015.html