简体   繁体   English

Rcpp找不到Rtools

[英]Rcpp does not find Rtools

My Problem 我的问题

I installed Rtools and added the path to my PATH variable: 我安装了Rtools并将路径添加到我的PATH变量中:

mPath <- strsplit(Sys.getenv("PATH"), ";")[[1]]
mPath[grep("Rtools", mPath)]
# [1] "C:\\Temp\\Rtools\\bin"              "C:\\Temp\\Rtools\\gcc-4.6.3\\bin"  
# [3] "C:\\Temp\\Rtools\\gcc-4.6.3\\bin32" "C:\\Temp\\Rtools\\mingw_32\\bin"

(So you can see it is not installed directly at c:\\Rtools ) (因此您可以看到它没有直接安装在c:\\Rtools

When I try to run a simple Rcpp snippet, I get the following error: 当我尝试运行一个简单的Rcpp代码段时,出现以下错误:

library(Rcpp)
evalCpp("1+1")

[...] [...]

c:/Rtools/mingw_32/bin/g++: not found c:/ Rtools / mingw_32 / bin / g ++:找不到

So basically Rcpp is looking in C:/Rtools ignoring my PATH variable. 因此,基本上Rcpp在看C:/Rtools忽略了我的PATH变量。

Workaround 解决方法

If I run 如果我跑步

library(installr)
install.Rtools()

Loading required namespace: devtools 加载所需的名称空间:devtools

No need to install Rtools - You've got the relevant version of Rtools installed 无需安装Rtools-您已经安装了相关版本的Rtools

and then run evalRcpp("1+1") again, everything works as expected. 然后再次运行evalRcpp("1+1") ,一切正常。

My Question 我的问题

Why does it not work right away? 为什么不立即起作用? How do I tell Rcpp to look in the right folder? 如何告诉Rcpp在正确的文件夹中查找? How does install.Rtools manage to convince Rcpp to look into the right folder? install.Rtools如何设法说服Rcpp查找正确的文件夹? How can I achieve that without the workaround? 没有解决方法,我该如何实现?

Had the same problem. 有同样的问题。 The system is not (yet) compatible with Rtools 3.5. 该系统与Rtools 3.5不兼容。 Also, there seems to be an issue that they re-named it to RBuildTools instead of RTools. 另外,似乎存在一个问题,他们将其重命名为RBuildTools而不是RTools。 Install the former version 3.4 on https://cran.r-project.org/bin/windows/Rtools/ . https://cran.r-project.org/bin/windows/Rtools/上安装旧版本3.4。 This did the job for me! 这为我做了工作!

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

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