gpt4 book ai didi

r - 在 Ubuntu 上安装 R gsl 包

转载 作者:行者123 更新时间:2023-12-04 14:02:22 24 4
gpt4 key购买 nike

我无法在我的 ubuntu 18.04 LTS 上安装 R 包 gsl,我不明白问题是什么。
从 R 中:

> install.packages('gsl')
* installing *source* package ‘gsl’ ...
** package ‘gsl’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gsl-config... /usr/bin/gsl-config
checking if GSL version >= 2.1... checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
configure: error: Need GSL version >= 1.16
ERROR: configuration failed for package ‘gsl’
* removing ‘/home/luca_ph/R/lib/R/library/gsl’
它说它需要 gsl 版本 >= 1.16,但是我已经安装了它:
dpkg -s libgsl-dev | grep Version
Version: 2.4+dfsg-6
此外, gsl-config 在 $PATH 中可用(如建议的 here
我试图在调用它时将适当的编译器参数传递给 R(如建议的 here ),但是它同样失败了:
> gsl-config --libs
-L/usr/lib/x86_64-linux-gnu -lgsl -lgslcblas -lm
> gsl-config --cflags
-I/usr/include
> CFLAGS="-I/usr/include" LDFLAGS="-L/usr/lib/x86_64-linux-gnu -lgsl -lgslcblas -lm" R
> install.packages('gsl')
[...]
* installing *source* package ‘gsl’ ...
** package ‘gsl’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gsl-config... /usr/bin/gsl-config
checking if GSL version >= 2.1... checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
configure: error: Need GSL version >= 1.16
ERROR: configuration failed for package ‘gsl’
我在这里缺少什么?
非常感谢!

最佳答案

尽管有错误消息,R 包 gsl现在需要 GSL 版本 >= 2.5(见 here)。即使我能够安装最新版本的 GSL (2.7),我也没有足够的知识来遵循 R 包的 INSTALL 文件中的建议:

If the gsl R package builds successfully but will not load, make sure to inform your system linker/loader where to find the GSL libraries used to compile it. That step may be missed when using a manual GSL installation as opposed to one performed by a package manager.


所以我选择使用链接到 How to get GNU software 中的 PPA 存储库。提供 GSL 2.5 版的网页。
简而言之,我运行这些命令来解决您描述的问题:
sudo add-apt-repository ppa:dns/gnu
sudo apt-get update
sudo apt install libgsl-dev
不是 100% 确定这是否普遍适用,但我还必须使用 sudo apt remove 删除以前版本的 GSL安装新版本之前的命令。

关于r - 在 Ubuntu 上安装 R gsl 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69583193/

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