从R内部设置LD_LIBRARY_PATH [英] Setting LD_LIBRARY_PATH from inside R

查看:311
本文介绍了从R内部设置LD_LIBRARY_PATH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了R软件包,但是为了通过library加载它,需要将LD_LIBRARY_PATH设置为一个名为libhts.so.2的库所在的路径.加载仅在进入R之前编辑LD_LIBRARY_PATH时有效,而之后则无效.

I have installed an R package but, in order to load it via library, the LD_LIBRARY_PATH needs to be set to the path where one of the libraries, called libhts.so.2 is located. The loading only works when editing the LD_LIBRARY_PATH before going into R, not after.

我尝试了几种不同的方法来解决这个问题:

I have tried several different methods in solving this:

  1. 从R包中的configure脚本导出修改后的LD_LIBRARY_PATH.
  2. 在相同的configure脚本中创建指向共享库的软链接.
  1. exporting a modified LD_LIBRARY_PATH from the configure script located in the R package.
  2. Creating a soft link to the shared library within the same configure script.

两个都不起作用,在我看来,一旦启动R,就有一个变量存储LD_LIBRARY_PATH的结果.也许解决方案是编辑该变量.

Both have not worked and it seems to me that there is a variable that stores the results of the LD_LIBRARY_PATH once R is started. Maybe the solution is editing that variable.

推荐答案

Hans Lub 的帮助下,解决问题的方法是使用dyn.load()函数并提供完整的路径库:

With help from Hans Lub, the way to solve the problem is by using the dyn.load() function and supplying the full path to the library:

dyn.load('path_to_library')

,然后通过library加载应该可以.

and then, loading via library should work.

这篇关于从R内部设置LD_LIBRARY_PATH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆