linuxlibrarypath
发布时间: 2023-11-09 20:52:04
‘壹’ R在linux中的library path的问题:
问题:
非root权限下安装的R包都是默认安装在
/home/[yourname]/R/x86_64-pc-linux-gnu-library/[version]
这就导致一个问题,别的用户无法使用到你安装的包,需要自己再安装一遍,这样就很麻烦
解决办法:将别人的R library path 加载到自己的R环境变量中就可以了:
先查看一下包的安装路径:
.libPath()
[1] "/home/user2/R/x86_64-pc-linux-gnu-library/4.1"
[2] "/usr/local/lib/R/site-library"
[3] "/usr/lib/R/site-library"
[4] "/usr/lib/R/library"
安装时会按照顺序安装,
[1] "/home/balter/conda/envs/dada2/lib/R/library" "/usr/local/lib/R/site-library"
[3] "/usr/lib/R/site-library" "/usr/lib/R/library"
export R_LIBS="/home/user2/R/x86_64-pc-linux-gnu-library/4.1"
即可凑合用。
更专业点就是修改R启动时候加载的Rprofile文件,参考:
https://www.cnblogs.com/jessepeng/p/10984983.html
热点内容