R包安装:installation of package 'phangorn' had non-zero exit status

本文聚焦Ubuntu系统中R包安装问题。安装'phangorn'包时出现'had non-zero exit status'错误,安装依赖ape时还出现'/usr/bin/ld: cannot find -lxxx'错误。分析了'-lxxx'错误的三种可能原因,并给出判断symbolic link是否正确及安装相应lib的解决办法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、安装错误:installation of package 'phangorn' had non-zero exit status

在Ubuntu中,R包安装的过程中出现:installation of package 'phangorn' had non-zero exit status
'phangorn'是包名,其它的包出现这个错误时,解决办法类似。
这是一个比较概括性的错误,导致错误的根本原因在前面的安装过程中有详细的说明。
我在安装 'phangorn'包时,报的错是在安装第一个依赖ape时出现:

/usr/bin/ld: cannot find -lblas
/usr/bin/ld: cannot find -llapack

二、/usr/bin/ld: cannot find -lxxx 解决方法

/usr/bin/ld: cannot find -lblas
/usr/bin/ld: cannot find -llapack

-lxxx:l 代表 lib,xxx代表库名
在 /usr/lib 中相应的库的命名规则:lib+库名+.so

出现这个错误的原因可能有以下三种:
1、系统中没有安装相应的 lib
2、相应的 lib的版本不对
3、lib 的symbolic link不正确,没有连接到正确的函式库文件

解决方法:
1、先判断 /usr/lib 下的相应的函式库文件(.so)的symbolic link是否正确。
      ln -s libxxx.so.x libxxx.so
2、若不是第3点原因,就在系统中安装相应的 lib 即可。
      apt-get install libxxx-dev

在我的系统中,导致错误的是lib 的symbolic link不正确。我的做法是:

cd /usr/lib
ln -s libblas.so.12 libblas.so

 

R版本没问题,是最新的,但是仍然报错如下:> warnings() Warning messages: 1: In install.packages("ggplot2", dependencies = TRUE) : installation of package ‘proxy’ had non-zero exit status 2: In install.packages("ggplot2", dependencies = TRUE) : installation of package ‘checkmate’ had non-zero exit status 3: In install.packages("ggplot2", dependencies = TRUE) : installation of package ‘KernSmooth’ had non-zero exit status 4: In install.packages("ggplot2", dependencies = TRUE) : installation of package ‘wk’ had non-zero exit status 5: In install.packages("ggplot2", dependencies = TRUE) : installation of package ‘farver’ had non-zero exit status 6: In install.packages("ggplot2", dependencies = TRUE) : installation of package ‘lattice’ had non-zero exit status 7: In install.packages("ggplot2", dependencies = TRUE) : installation of package ‘cluster’ had non-zero exit status 8: In install.packages("ggplot2", dependencies = TRUE) : installation of package ‘nnet’ had non-zero exit status 9: In install.packages("ggplot2", dependencies = TRUE) : installation of package ‘foreign’ had non-zero exit status 10: In install.packages("ggplot2", dependencies = TRUE) : installation of package ‘data.table’ had non-zero exit status 11: In install.packages("ggplot2", dependencies = TRUE) : installation of package ‘colorspace’ had non-zero exit status 12: In install.packages("ggplot2", dependencies = TRUE) : installation of package ‘mvtnorm’ had non-zero exit status 13: In install.packages("ggplot2", dependencies = TRUE) : installation of package ‘SparseM’ had non-zero exit status 14: In install.packages("ggplot2", dependencies = TRUE) : installation of package ‘units’ had non-zero exit status 15: In install.packages("ggplot2", dependencies = TRUE) : installation of package ‘isoband’ had non-zero exit status 16: In install.packages("ggplot2", dependencies = TRUE) : installation of package ‘MASS’ had non-zero exit status 17: In install.packages("ggplot2", dependencies = TRUE) :
最新发布
03-09
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值