我希望能夠為 Ubuntu 18.04 安裝最新的穩定 R 版本,我安裝了 ubuntu 版本,所以我刪除了它,然後按照以下指南進行操作這關聯。
無論我做什麼,當我發出以下輸出時,我都會得到以下輸出sudo apt-get install r-base
:
sudo apt 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 (>= 3.6.1-3disco) but it is not going to be installed
Depends: r-recommended (= 3.6.1-3disco) 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.
怎麼了? (我做了所有的apt update
等等)
答案1
對於遇到相同問題的人,我在以下位置找到了解決方案: 無法在 Ubuntu Bionic Beaver (18.04) 中安裝 R 3.5.0
我只是按順序發出這些命令,然後就可以安裝:
- 暫時刪除
deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/
自/etc/apt/sources.list
sudo apt-get autoremove sudo apt-get update sudo apt-get upgrade
- 添加
deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/
回/etc/apt/sources.list
sudo apt-get update
sudo apt-get install r-base
就是這樣(安裝了 R 3.6.1)。
答案2
這個解決方案對我有用: https://linuxize.com/post/how-to-install-r-on-ubuntu-18-04/
- 安裝透過 HTTPS 新增儲存庫所需的軟體包:
sudo apt install apt-transport-https software-properties-common
- 使用下列命令啟用 CRAN 儲存庫並將 CRAN GPG 金鑰新增至您的系統:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
- 現在已新增 apt 儲存庫,請更新軟體包清單並透過鍵入以下內容安裝 R 軟體包:
sudo apt update sudo apt install r-base
- 若要驗證安裝是否成功,請執行以下命令,該命令將列印 R 版本:
R --version