简体   繁体   English

RStudio找不到RTools

[英]RStudio not finding RTools

I have R, RStudio, and devtools installed (some output below omitted) and updated. 我安装了R,RStudio和devtools(省略了一些输出)并进行了更新。 I have also installed the most recent version of Rtools: 我还安装了最新版本的Rtools:

# Check R version
R.Version()
$platform
[1] "x86_64-w64-mingw32"

# OUTPUT OMITTED

$version.string
[1] "R version 3.4.3 (2017-11-30)"

# Check devtools for Rtools installation
devtools::find_rtools()
[1] TRUE

Yet when I press Ctrl + Shift + B to build a package in RStudio, I am informed Rtools is not found: 然而,当我按下Ctrl + Shift + B在RStudio中构建一个包时,我被告知没有找到Rtools:

==> devtools::build()

"C:/PROGRA~1/R/R-34~1.3/bin/x64/R" --no-site-file --no-environ --no-save  \
  --no-restore --quiet CMD build  \
  "C:\Users\name\mypkg" --no-resave-data  \
  --no-manual 

* checking for file 
'C:\Users\name/mypkg/DESCRIPTION' ... OK
* preparing 'mypkg':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building 'mypkg_0.1.0.tar.gz'

[1] "C:/Users/name/mypkg_0.1.0.tar.gz"

Source package written to C:/Users/brett/Dropbox/Duke/package_development
WARNING: Rtools is required to build R packages but is not currently 
installed. Please download and install the appropriate version of Rtools 
before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/

Previous posts on this issue (see: Rtools not being detected by R ) have focused on the system path, but not specified how to set it or where. 此问题上的先前帖子(请参阅: R未检测到Rtools )专注于系统路径,但未指定如何设置或在何处设置。 Furthermore, the OP in that post wrote the toolchain option was not included during the Rtools installation or the directory is incorrect for the path ( R 3.3.0 installing a package on Windows: gcc not found error ). 此外,在该帖子中写入工具链选项的OP未包含在Rtools安装期间或路径的目录不正确( R 3.3.0在Windows上安装包:gcc not found错误 )。 In my case, both toolchain boxes have been checked (see image) below the code showing the system path. 就我而言,在显示系统路径的代码下方检查了两个工具链盒(见图)。

# Check system path
Sys.getenv()['PATH']

PATH                    C:/Rtools/bin;C:\Rtools\bin;C:\Program
                        Files\R\R-3.4.3\bin\x64;C:\Rtools\bin;C:\Program
                        Files (x86)\Intel\iCLS Client\;C:\Program
                        Files\Intel\iCLS
                        Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program
                        Files (x86)\Intel\Intel(R) Management Engine
                        Components\DAL;C:\Program Files\Intel\Intel(R)
                        Management Engine Components\DAL;C:\Program
                        Files (x86)\Intel\Intel(R) Management Engine
                        Components\IPT;C:\Program Files\Intel\Intel(R)
                        Management Engine Components\IPT;C:\Program
                        Files\MiKTeX 2.9\miktex\bin\x64\;C:\Program
                        Files
                        (x86)\PharosSystems\Core;C:\WINDOWS\System32\OpenSSH\;C:\Users\name\AppData\Local\Microsoft\WindowsApps;

在此输入图像描述

I suspect the path is still somehow the problem, but the solution here doesn't specify exactly what one should look for, how to find it, and what the final solution looks like: RStudio cannot find Rtools to build package 我怀疑路径仍然是某种程度上的问题,但这里的解决方案并没有明确指出应该寻找什么,如何找到它,以及最终的解决方案是什么样的: RStudio无法找到Rtools来构建包

Can someone offers suggestions on solutions to detect rtools in Rstudio? 有人可以提供有关在Rstudio中检测rtools的解决方案的建议吗?

I have sorted the problem in this way, partly guided by the comments on the question at: 我已经用这种方式对问题进行了排序,部分是由对以下问题的评论引导:

Rtools not being detected by R R没有检测到Rtools

Given that devtools::find_rtools() returns TRUE and the check at the end of this webpage using Rcpp ( https://thecoatlessprofessor.com/programming/installing-rtools-for-compiled-code-via-rcpp/ ) works: 鉴于devtools::find_rtools()返回TRUE并使用Rcpphttps://thecoatlessprofessor.com/programming/installing-rtools-for-compiled-code-via-rcpp/ )在此网页末尾进行检查:

Try Sys.which("ls.exe") and Sys.which("gcc.exe") . 试试Sys.which("ls.exe")Sys.which("gcc.exe") The former should return a path, but the latter may be empty, which is the problem. 前者应该返回路径,但后者可能是空的,这就是问题所在。

I then found another copy of gcc.exe (in my case it there was one at C:\\Rtools\\mingw_64\\bin , which is a bit maddening) and copied it into C:\\Rtools\\bin , which is where RStudio seems to want it. 然后我找到了gcc.exe另一个副本(在我的情况下,它有一个在C:\\Rtools\\mingw_64\\bin ,这有点令人抓狂)并将其复制到C:\\Rtools\\bin ,这是RStudio似乎的地方想要它。 That is where ls.exe was found using the Sys.which . 这就是ls.exe用的是发现Sys.which That solved the problem for me. 这解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM