在macOS Catalina上的RStudio中安装软件包失败 [英] Installing a package inside RStudio fails on macOS Catalina

查看:518
本文介绍了在macOS Catalina上的RStudio中安装软件包失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在macOS Catalatina,上的RStudio内部安装软件包时,失败,并出现Permission Denied错误:

While trying to install a package inside RStudio on macOS Catalatina, it fails with a Permission Denied error:

> install.packages("mlbench")
trying URL 'https://cran.rstudio.com/src/contrib/mlbench_2.1-1.tar.gz'
Content type 'application/x-gzip' length 920768 bytes (899 KB)
==================================================
downloaded 899 KB

* installing *source* package ‘mlbench’ ...
** package ‘mlbench’ successfully unpacked and MD5 sums checked
mv: rename /usr/local/Cellar/r/3.6.1_1/lib/R/library/mlbench to /usr/local/Cellar/r/3.6.1_1/lib/R/library/00LOCK-mlbench/mlbench: Permission denied
ERROR: cannot remove earlier installation, is it in use?
* removing ‘/usr/local/Cellar/r/3.6.1_1/lib/R/library/mlbench’
Warning in install.packages :
  installation of package ‘mlbench’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/bc/wsz930gj3gn5zgq4hbm6jkfr0000gn/T/RtmpdvQLox/downloaded_packages’
Updating HTML index of packages in '.Library'
Warning in install.packages :
  cannot create file '/usr/local/Cellar/r/3.6.1_1/lib/R/doc/html/packages.html', reason 'Permission denied'
Warning in install.packages :
  cannot update HTML package index

推荐答案

在此由RStudio支持:

As stated here by RStudio Support:

您可以在R中安装软件包吗?

如果遇到问题,建议您尝试在R中安装软件包 (在RStudio之外),看看您是否能够做到这一点.如果没有,请 请在下面查看可能的解决方案.

If you're having issues, we recommend trying to install packages in R (outside of RStudio) and see if you're able to do that. If not, please check the possible solutions below.

因此,需要:

  • 切换到Terminal.app
  • 但是,R控制台必须以sudo特权启动(否则,它将再次失败,并出现perssion拒绝错误):sudo R
  • 然后安装所需的任何软件包:install.packages("mlbench").
  • switch to Terminal.app,
  • however, R console must be started with the sudo privileges(otherwise, it will yet again fail with a perission denied error): sudo R,
  • and then install whatever package is necessary: install.packages("mlbench").

这篇关于在macOS Catalina上的RStudio中安装软件包失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆