Rstudio 中的源.bashrc
Source .bashrc in Rstudio
我刚刚在 Ubuntu 18.04 LTS 中本地安装了一些 Perl 模块。
像这样使用 RStudio 服务器调用它们时
system("perl -MBio::TreeIO -e 1")
我收到以下错误
Can't locate Bio/TreeIO.pm in @INC (you may need to install the Bio::TreeIO module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base)
当我在终端source ~/.bashrc
时一切正常。
我尝试创建一个 ~/.Rprofile
包含:
system(". ~/.bashrc")
但不好。
根据 R shell 中的 运行 help(Startup)
访问的文档,您应该在主目录中创建一个文件 .Renviron
,当启动一个新的 R 会话。例如:
.Renviron
FOOBAR=/foo/bar/foo/bar
R shell
R
R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
...
> cat(Sys.getenv("FOOBAR"), "\n")
/foo/bar/foo/bar
因此只需创建 .Renviron
文件,并将 PERL5LIB
变量设置为本地 perl 软件包安装目录。
我刚刚在 Ubuntu 18.04 LTS 中本地安装了一些 Perl 模块。
像这样使用 RStudio 服务器调用它们时
system("perl -MBio::TreeIO -e 1")
我收到以下错误
Can't locate Bio/TreeIO.pm in @INC (you may need to install the Bio::TreeIO module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base)
当我在终端source ~/.bashrc
时一切正常。
我尝试创建一个 ~/.Rprofile
包含:
system(". ~/.bashrc")
但不好。
根据 R shell 中的 运行 help(Startup)
访问的文档,您应该在主目录中创建一个文件 .Renviron
,当启动一个新的 R 会话。例如:
.Renviron
FOOBAR=/foo/bar/foo/bar
R shell
R
R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
...
> cat(Sys.getenv("FOOBAR"), "\n")
/foo/bar/foo/bar
因此只需创建 .Renviron
文件,并将 PERL5LIB
变量设置为本地 perl 软件包安装目录。