我正在尝试运行以下代码:
library(Rcpp)
evalCpp("2+2", verbose=TRUE)
使用anaconda环境通过jupyter笔记本电脑
。当我在相同的anaconda环境中运行时,相同的代码可以在终端上正常工作,但在Jupyter笔记本电脑中则无法工作,并因以下错误而失败:
Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir, : Error 1 occurred building shared library.
Traceback:
1. evalCpp("2+2", verbose = TRUE)
2. cppFunction(code, depends = depends, plugins = plugins, includes = includes,
. env = env, rebuild = rebuild, cacheDir = cacheDir, showOutput = showOutput,
. verbose = verbose)
3. sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir,
. showOutput = showOutput, verbose = verbose)
4. stop("Error ", result, " occurred building shared library.")
WARNING: The tools required to build C++ code for R were not found.
Please install GNU development tools including a C++ compiler.
我厌倦了另一个question的安装,但这确实有帮助。