gpt4 book ai didi

Rcpp jupyter 笔记本

转载 作者:太空狗 更新时间:2023-10-29 12:09:49 61 4
gpt4 key购买 nike

我已经使用此命令在 R 控制台中安装了 Rcpp,该命令直到现在通常用于安装要在 jupyter 笔记本上运行的软件包:

install.packages('Rcpp', '/home/user/anaconda3/lib/R/library/')

然后在控制台我做:

library(Rcpp)
evalCpp("2+2")

它可以工作,但是当我在 Jupyter notebooks 上做同样的事情时它不起作用,给我这个错误信息:

/home/tyatabe/anaconda3/bin/x86_64-conda_cos6-linux-gnu-c++ -I/home/tyatabe/anaconda3/lib/R/include -DNDEBUG -I'/home/tyatabe/anaconda3/lib/R/library/SimInf/include' -I"/home/tyatabe/anaconda3/lib/R/library/Rcpp/include" -I"/tmp/RtmpC4usUT/sourceCpp-x86_64-conda_cos6-linux-gnu-0.12.15" -D_FORTIFY_SOURCE=2 -O2 -I/home/tyatabe/anaconda3/include -fpic -O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function -flto -ffat-lto-objects -Wno-unused-local-typedefs -Wno-ignored-attributes -Wno-deprecated-declarations -c file345f2e80a7c7.cpp -o file345f2e80a7c7.o /home/tyatabe/anaconda3/lib/R/etc/Makeconf:167: recipe for target 'file345f2e80a7c7.o' failed Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir, : Error 1 occurred building shared library. Traceback:

  1. evalCpp("2+2")
  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 ", status, " 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.

我在装有 Ubuntu 16.04 的 64 位机器上运行。

关于如何让 Rcpp 在 jupyter 上工作有什么想法吗?

谢谢,

多田

最佳答案

正如@DirkEddelbuettel 提到的...Anaconda 在 Ubuntu 上并不理想...

如果您真的想要进行此设置,Rcpp FAQ 中有一个最近的条目关于编译器和 Anaconda...特别是,我们有:

In a comment to issue ticket#770 it is stated that running

sh conda install gxx_linux-64

helps within this enivronment as it installs the corresponding x86_64-conda_cos6-linux-gnu-c++ compiler.

关于Rcpp jupyter 笔记本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48649359/

61 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com