简体   繁体   English

运行 rstan 程序时,compileCode 出错(错误 127)

[英]Error in compileCode (Error 127) When running rstan program

I am trying to install Rstan.我正在尝试安装 Rstan。 I have no problem installing the package and running it.我安装 package 并运行它没有问题。 However, when I try running a program that uses the library I get the following error:但是,当我尝试运行使用该库的程序时,出现以下错误:

    Error in compileCode(f, code, language = language, verbose = verbose) : 
sh: line 1: K:/Software/rtools40/ucrt64/mingw_64/bin/g++: 
No such file or directorymake: *** [K:/Software/R-41~1.2/etc/x64/Makeconf:245: file9706b781d3e.o] Error 127
Error in sink(type = "output") : invalid connection

I have spent some time trying to trouble shoot it but I simply cannot solve it.我花了一些时间试图解决它,但我根本无法解决它。 I have checked that rtools is in the path using:我已经使用以下命令检查了 rtools 是否在路径中:

writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")

When I went directly into the directorymake referenced by the error [K:/Software/R-41~1.2/etc/x64/Makeconf:245: file9706b781d3e.o] it is there!当我直接进入错误[K:/Software/R-41~1.2/etc/x64/Makeconf:245: file9706b781d3e.o]引用的目录时,它就在那里! But the K:/Software/rtools40/ucrt64/mingw_64/bin/g++ is not.但是K:/Software/rtools40/ucrt64/mingw_64/bin/g++不是。 Specifically the ~/mingw_64/bin/g++ .特别是~/mingw_64/bin/g++
Does anyone has had this issue?有人遇到过这个问题吗?
How can I point rstan to a different directory or restore the default one?如何将 rstan 指向不同的目录或恢复默认目录? ( Note: I have uninstall it and install it using the headers and without headers and updated rtools and R 注意:我已经卸载它并使用标题安装它,没有标题和更新的 rtools 和 R

Answer: Needed to configure the C++ Tool Chain as per this guide: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows .答:需要按照本指南配置 C++ 工具链: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows I had issues with this as well but everything got resolved when I deleted the .Rprofile file int he documents folder.我也遇到了这个问题,但是当我删除文档文件夹中的.Rprofile文件时,一切都得到了解决。

After configuring the C++ tool I put Rtools in the path again and it worked seamlessly!配置 C++ 工具后,我再次将 Rtools 放入路径中,它可以无缝运行!

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

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