问题描述
我已经使用以下命令在R控制台中安装了Rcpp,到目前为止,该命令通常可用于安装要在jupyter笔记本上运行的软件包:
I have installed Rcpp in the R console with this command that until now ussually works for installing packages to run on jupyter notebooks:
install.packages('Rcpp', '/home/user/anaconda3/lib/R/library/')
然后在控制台中执行:
library(Rcpp)
evalCpp("2+2")
它可以工作,但是当我在Jupyter笔记本上执行相同操作时,它不起作用,给我以下错误消息:
and it works, but when I do the same on Jupyter notebooks it does not work, giving me this error message:
- evalCpp("2 + 2")
- cppFunction(代码,取决于=取决于,插件=插件,包含=包含,.env = env,重建=重建,cacheDir = cacheDir, showOutput = showOutput,. verbose = verbose)
- sourceCpp(代码=代码,env = env,重建=重建,cacheDir = cacheDir,.showOutput = showOutput,详细=详细)
- 停止(错误",状态为正在建立共享库.")
- evalCpp("2+2")
- cppFunction(code, depends = depends, plugins = plugins, includes = includes, . env = env, rebuild = rebuild, cacheDir = cacheDir, showOutput = showOutput, . verbose = verbose)
- sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir, . showOutput = showOutput, verbose = verbose)
- stop("Error ", status, " occurred building shared library.")
警告:未找到为R构建C ++代码所需的工具.
WARNING: The tools required to build C++ code for R were not found.
请安装包括C ++编译器的GNU开发工具.
Please install GNU development tools including a C++ compiler.
我正在使用Ubuntu 16.04的64位计算机上运行.
I'm running on a 64 bit machine with Ubuntu 16.04.
关于如何使Rcpp在jupyter上工作的任何想法?
Any ideas on how can I make Rcpp work on jupyter?
谢谢
Tada
推荐答案
@DirkEddelbuettel提到了... Anaconda在Ubuntu上并不理想...
As @DirkEddelbuettel mentioned... Anaconda isn't ideal on Ubuntu...
如果您真的要进行此设置,则最近有关于编译器和Anaconda的Rcpp常见问题解答 ...特别是,我们有:
If you really want to have this setup, there was a recent entry to the Rcpp FAQ regarding compilers and Anaconda... In particular, we have:
sh conda install gxx_linux-64
在此环境中提供帮助,因为它安装了相应的 x86_64-conda_cos6-linux-gnu-c++
编译器.
helps within this enivronment as it installs the corresponding x86_64-conda_cos6-linux-gnu-c++
compiler.
这篇关于RCPP Jupyter笔记本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!