windows 使文件可写以添加新包

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31018358/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:08:43  来源:igfitidea点击:

Make a file writable in order to add new packages

rwindows

提问by angs

I use Rstudio and try to add new packages through command console.

我使用 Rstudio 并尝试通过命令控制台添加新包。

It fails to install it for this reason

由于这个原因它无法安装

install.packages("devtools"); devtools::install_github("hadley/rvest")
Warning in install.packages :
  'lib = "C:/Program Files/R/R-3.2.1/library"' is not writable
Warning in install.packages :
  cannot create dir 'C:\Users\myuser', reason 'Permission denied'
Error in install.packages : unable to create ‘C:/Users/myuser/Documents/R/win-library/3.2'
Error in loadNamespace(name) : there is no package called ‘devtools'

How can I make this file writable?

我怎样才能使这个文件可写?

采纳答案by George

Changing the security setting on the R folder to "full control" fixed this for me. See the third posting down at this link for step by step instructions: Unable to update R packages in default library on Windows 7

将 R 文件夹上的安全设置更改为“完全控制”为我解决了这个问题。有关分步说明,请参阅此链接上的第三个帖子:无法更新 Windows 7 上默认库中的 R 包

回答by user5587415

Just run RStudio as an administrator. Right-Click on it and choose run as Administrator

只需以管理员身份运行 RStudio。右键单击它并选择以管理员身份运行

回答by Adam_G

I ran into this problem. The issue for me was using single quotes instead of double quotes. Using install.packages("foo")worked fine, whereas install.packages('foo')caused this issue.

我遇到了这个问题。我的问题是使用单引号而不是双引号。使用install.packages("foo")工作正常,而install.packages('foo')导致此问题。

回答by Bishal Shrestha

As i have found out that disabling the Ransomware protection on Window Defender allows me to write in the directory.

正如我发现在 Window Defender 上禁用勒索软件保护允许我在目录中写入。

This solved the problem. Hope it works for you.

这解决了问题。希望对你有效。