我需要安装R
3.0.2,因为所需的库尚与 3.0.3(最新版本)不兼容。
我可以像这样安装旧版本的 R:
sudo apt-get install r-base=3.0.2-1precise0
但是 r-base 的所有依赖项都尝试使用 3.0.3 进行安装
root@foo:~# apt-get install r-base=3.0.2-1precise0
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-recommended (= 3.0.2-1precise0) but 3.0.3-1precise0 is to be installed
E: Unable to correct problems, you have held broken packages.
如何安装 r-base 3.0.2 及其所有依赖项作为 3.0.2?
答案1
首先删除软件包
sudo apt-get remove r-base
一点清洁
sudo apt-get clean; sudo apt-get autoclean
重新安装R强制使用旧版本
sudo apt-get install r-base=3.0.2-1precise0
答案2
您可以通过简单的安装来降级软件包。apt 足够智能,可以正确处理这个问题。
为了安装 R 3.0.2,我运行了 dpkg -S /usr/bin/R,发现二进制文件由 提供r-base-core
。降级后解决了该问题
apt-get install r-base-core=3.0.2-1precise0
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
r-cran-foreign ...
Use 'apt-get autoremove' to remove them.
Suggested packages:
ess r-doc-info r-doc-pdf r-mathlib
The following packages will be REMOVED:
r-base r-cran-class r-cran-cluster r-cran-kernsmooth r-cran-mass r-cran-matrix r-cran-mgcv r-cran-nlme r-recommended
The following packages will be DOWNGRADED:
r-base-core
0 upgraded, 0 newly installed, 1 downgraded, 9 to remove and 123 not upgraded.
Need to get 21.5 MB of archives.
apt-get install r-base=3.0.2-1precise0
...
apt-get install r-recommended=3.0.2-1precise0
...
答案3
从软件和更新中禁用“Universe”存储库,然后在终端上运行以下命令,
sudo add-apt-repository ppa:marutter/rdev
sudo apt-get update
sudo apt-get install r-base