我想用 Rstudio 安装 R 开始学习,但是我发现了很多问题,我会在下面尽可能多地解释。
所以我去了 CRAN 项目网站https://cran.r-project.org/并按照他们的说明在我的笔记本电脑上安装 R。
# update indices
apt update -qq
# install two helper packages we need
apt install --no-install-recommends software-properties-common dirmngr
# import the signing key (by Michael Rutter) for these repo
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
# add the R 4.0 repo from CRAN -- adjust 'focal' to 'groovy' or 'bionic' as needed
add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
apt install --no-install-recommends r-base
之后,我去 RStudio 网页并下载rstudio-server-1.4.1717-amd64.deb
. 首先,我尝试使用 GUI 安装它,但出现以下消息:
GPG 错误:https ://cloud.r-project.org/bin/linux/ubuntu focus-cran40/ InRelease:无法验证以下签名,因为公钥不可用:NO_PUBKEY 51716619E084DAB9
存储库“https://cloud.r-project.org/bin/linux/ubuntu focus-cran40/InRelease”未签名。
从这样的存储库更新不能安全地完成,因此默认情况下被禁用。
有关存储库创建和用户配置的详细信息,请参见 apt-secure(8) 手册页。
然后我尝试安装它sudo apt install ./rstudio-server-1.4.1717-amd64.deb
并发生以下情况:
Note, selecting 'rstudio' instead of './rstudio-1.4.1717-amd64.deb'
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:
rstudio : Depends: libclang-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
最后,当我发现许多使用 gdebi 安装的教程时,我又试了一次:
gdebi rstudio-1.4.1717-amd64.deb
产生:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading state information... Done
This package is uninstallable
Cannot install 'libclang-dev'
所以显然 libclang-dev 发生了一些事情,我尝试安装它:
sudo apt install libclang-dev
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:
libclang-dev : Depends: libclang-10-dev (>= 10~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
所以我尝试安装 libclang-10-dev 但它让我遇到了另一个类似于此处显示的依赖问题。我认为手动完成这一连串问题不会很快结束。
我能给你的最后一条信息:
当我运行rstudio
它说command not found
。
现在,当我这样做时,apt update
我会收到与上面相同的消息,以“GPG”开头
我可以提供的最后一条信息是,当我R
在命令行中运行时,我可以从那里使用 R 语言。
如果你碰巧知道我能做些什么来解决这个问题,我将不胜感激。
为了解决安装问题,我发现了以下内容:
https://stackoverflow.com/questions/67383617/unable-to-install-rstudio-cannot-install-libclang-dev
您首先需要安装 aptitude
然后你可以运行
对第一个问题说不,对第二个问题说是。
然后你可以用 gdebi 安装 RStudio。