问题描述
我没有成功安装r-base的最新版本(2.15.2)。显然,R软件包Rcpp
不会安装R版本2.14.1 – 为我安装的版本。
我不确定更改我的安装尝试的内容/方式/位置,如下所示。请注意,我使用的是ubuntu-12.04.1-server-i386。
目前安装的版本是R版本2.14.1(2011-12-22):
$ sudo apt-get install r-base
Reading package lists... Done
Building dependency tree
Reading state information... Done
r-base is already the newest version.
包含版本信息无济于事:
$ sudo apt-get install r-base=2.15.1-5ubuntu1
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Version '2.15.1-5ubuntu1' for 'r-base' was not found
基于来自http://cran.r-project.org/bin/linux/ubuntu/README的CRAN Ubuntu指令的更改:
-
添加到
/etc/apt/sources.list
deb http://lib.stat.cmu.edu/R/CRAN/bin/linux/ubuntu quantal/
-
更新并安装
$ sudo apt-get update $ 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 : Depends: r-base-core (>= 2.15.2-1quantal2) but it is not going to be installed Depends: r-recommended (= 2.15.2-1quantal2) 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://stackoverflow.com/questions/16093331/how-to-install-r-version-3-0的答案
卸载旧R:
sudo apt-get remove r-base-core
然后:
sudo add-apt-repository "deb http://cran.rstudio.com/bin/linux/ubuntu $(lsb_release -sc)/"
然后将这些命令复制/粘贴到命令行中:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo add-apt-repository ppa:marutter/rdev
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install r-base
这对我有用
次佳解决方案
这就是我做的方式;
正如问题中已经提到的,我通过UBUNTU PACKAGES FOR R指令中的步骤添加了存储库,并进行了apt-get更新,然后
apt-cache showpkg r-base
会有类似的东西
Package: r-base
Versions:
3.0.2-1raring0 (/var/lib/apt/lists/cran.rstudio.com_bin_linux_ubuntu_raring_Packages)
Description Language:
File: /var/lib/apt/lists/cran.rstudio.com_bin_linux_ubuntu_raring_Packages
MD5: 5787ca79ed716232c4cc2087ed9b425b
3.0.1-6raring0 (/var/lib/apt/lists/cran.rstudio.com_bin_linux_ubuntu_raring_Packages)
Description Language:
File: /var/lib/apt/lists/cran.rstudio.com_bin_linux_ubuntu_raring_Packages
MD5: 5787ca79ed716232c4cc2087ed9b425b
我做了一个
sudo apt-get install -f r-base=3.0.2-1raring0
并做了。
第三种解决方案
打开终端并键入sudo -s
。然后输入以下命令打开source.list
:
gedit /etc/apt/sources.list
然后,将这些行添加到文件中:
deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu quetzal/
然后保存&退出gedit。在终端类型中
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -
然后键入
exit
然后输入这些命令 – 一次一行 – 。
sudo apt-get update
sudo apt-get install r-base
sudo apt-get install r-base-dev
第四种方案
在我的系统(没有安装R)中,版本正确安装。所以也许最好的选择是卸载旧的R并安装新的,传递你想要的特定版本。但在此之前,请备份您的操作系统。删除后重新安装旧包可能很困难。
另外一个注意事项:如果你做sudo apt-get install r-base=2.15.1-5ubuntu1
,它将找不到包,因为版本错误。在该repo中,文件被命名,例如r-base_2.15.2-1quantal2_all.deb
,因此正确的版本应该是r-base=2.15.2-1quantal2
或r-base=2.15.2-1quantal2_all
。
希望这可以帮助。