【发布时间】:2019-01-20 16:11:53
【问题描述】:
我安装了 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;
我怀疑路径仍然是问题所在,但这里的解决方案没有具体说明应该寻找什么,如何找到它,以及最终解决方案是什么样的:RStudio cannot find Rtools to build package
有人可以提供有关在 Rstudio 中检测 rtools 的解决方案的建议吗?
【问题讨论】:
-
我相信当前的 Rtools 需要编译器的路径,而不仅仅是其他工具(
C:\Rtools\bin可能是其他工具的路径;最近编译器在c:\Rtools\gcc-4.6.3\bin,但我好久没更新了。)。