RStudio 未检测到 Rtools [英] Rtools is not being detected from RStudio

查看:124
本文介绍了RStudio 未检测到 Rtools的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用最新的 R、RStudio 和 Rtools.

I am using latest R, RStudio and Rtools.

-- 我已经更新了环境变量.现在我可以从命令行调用 gcc 或 R.

-- I have updated the environment variables. Now I can call gcc, or R from command line.

当我尝试从 RStudio 发布应用程序时,我收到以下错误,

While I was trying to publish an app from the RStudio, I get the following error,

准备部署应用程序...完成上传包应用程序:64015 ...错误:* 应用程序依赖于包Rtools",但它没有安装.请在继续之前解决.执行停止

Preparing to deploy application...DONE Uploading bundle for application: 64015...Error: * Application depends on package "Rtools" but it is not installed. Please resolve before continuing. Execution halted

-- 我试过这个,在控制台上,

-- I have tried this,On Console,

> find_rtools(T)
Scanning path...
ls : D:Rtoolsinls.exe 
gcc: D:RtoolsGCC-46~1.3ingcc.exe 
VERSION.txt
Rtools version 3.3.0.1959 
Version: 3.3 
[1] TRUE

所以,Rtools 似乎基本上就在那里!

So, Rtools seems basically there!

-- 我已经检查了环境变量,这些都可以,因为我也提到了 R 和 gcc 可以从命令行启动

-- I have checked environment variables, those are OK, as I also mentioned R and gcc can be started from command line

然而,我尝试使用安装程序包从 RStudio 中安装和检查,它说,

Yet, I tried to install and check from within RStudio using installr package, it says,

> install.Rtools()
No need to install Rtools - You've got the relevant version of Rtools installed
> 

-- 这不可能是重复的,Rtools 未被 R 检测到我已经尝试了所有这些.没用.

-- This is not a possible duplication of this, Rtools not being detected by R I have tried all these. Did not work.

请提出解决方案.非常感谢您的宝贵时间.

Please suggest a solution. Thank you very much for your time.

推荐答案

我不知道为什么 RStudio 会时不时出现这种问题,但是这里描述了一种手动解决方法:

I have no idea why RStudio has such kind of problems from time to time but there is a manual work-around described here:

https://github.com/rwinlib/r-base/wiki/Testing-Packages-with-Experimental-R-Devel-Build-for-Windows

基本上你必须设置两个环境变量来指向正确的Rtools安装路径:

Basically you have to set two environment variables to point to the correct installation path of Rtools:

Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))
Sys.setenv(BINPREF = "C:/Rtools/mingw_$(WIN)/bin/")

为避免在重新启动 RStudio 后丢失此更改,您可以修改 (Windows) 环境变量,或将以下行添加到每次启动 R 时执行的 .Renviron 文件中.

To avoid losing this change after restarting RStudio you could modify your (Windows) environment variables instead or add the following rows to your .Renviron file that is executed at each startup of R.

顺便说一句:$(WIN) 部分是 no 拼写错误,但要求 R 可以注入32".或64"取决于您使用的 R 版本(32 位或 64 位).

BTW: The $(WIN) part is no typo but required so that R can inject "32" or "64" depending on the R version you are using (32 or 64 bit).

编辑 1: 另见最近发表的这篇 r-bloggers 文章:https://www.r-bloggers.com/quirks-about-running-rcpp-on-windows-through-rstudio/

Edit 1: See also this r-bloggers article published recently: https://www.r-bloggers.com/quirks-about-running-rcpp-on-windows-through-rstudio/

这篇关于RStudio 未检测到 Rtools的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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