gpt4 book ai didi

RStudio 未找到 RTools

转载 作者:行者123 更新时间:2023-12-03 02:22:20 24 4
gpt4 key购买 nike

我安装了 R、RStudio 和 devtools(下面省略了一些输出)并进行了更新。我还安装了最新版本的 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

然而,当我按 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/

之前关于此问题的帖子(请参阅: Rtools not being detected by R )重点讨论了系统路径,但没有指定如何设置或在何处设置。此外,该帖子中的 OP 写道,在 Rtools 安装过程中未包含工具链选项,或者路径的目录不正确 ( R 3.3.0 installing a package on Windows: gcc not found error )。就我而言,显示系统路径的代码下方的两个工具链框均已选中(参见图片)。

# 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;

enter image description here

我怀疑路径仍然是问题所在,但这里的解决方案没有具体说明应该寻找什么,如何找到它,以及最终的解决方案是什么样子:RStudio cannot find Rtools to build package

有人可以提供有关在 Rstudio 中检测 rtools 的解决方案的建议吗?

最佳答案

我已经按照这种方式对问题进行了排序,部分引用了该问题的评论:

Rtools not being detected by R

鉴于devtools::find_rtools()返回TRUE并使用 Rcpp 在此网页末尾进行检查( https://thecoatlessprofessor.com/programming/installing-rtools-for-compiled-code-via-rcpp/ )有效:

尝试Sys.which("ls.exe")Sys.which("gcc.exe") 。前者应该返回一个路径,但后者可能为空,这就是问题所在。

然后我找到了 gcc.exe 的另一个副本(就我而言, C:\Rtools\mingw_64\bin 有一个,这有点令人抓狂)并将其复制到 C:\Rtools\bin 中,这似乎正是 RStudio 想要的地方。那就是ls.exe的地方被发现使用 Sys.which 。这解决了我的问题。

关于RStudio 未找到 RTools,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51830648/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com