【发布时间】:2021-01-04 17:01:02
【问题描述】:
我可以毫无问题地从终端运行 perl 脚本“myperlscript.pl”。但是,如果我尝试在 RStudio 中运行相同的 perl 脚本,则会出现以下错误:
command <- "myperlscript.pl outputfile.txt"
system2('perl', command)
Can't locate Sort/Fields.pm in @INC (you may need to install the Sort::Fields module)
(@INC contains:
/Library/Perl/5.28/darwin-thread-multi-2level
/Library/Perl/5.28
/Network/Library/Perl/5.28/darwin-thread-multi-2level
/Network/Library/Perl/5.28
/Library/Perl/Updates/5.28.2
/System/Library/Perl/5.28/darwin-thread-multi-2level
/System/Library/Perl/5.28
/System/Library/Perl/Extras/5.28/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.28) at myperlscript.pl line 4.
BEGIN failed--compilation aborted at myperlscript.pl line 4.
我在 /Users/admin/perl5/perlbrew/perls/5.26.2/lib/site_perl/5.26.2 中安装了 Sort::Fields 模块,使用终端可以正常工作,但 RStudio 中的 perl 似乎没有为 perl 模块索引该目录 - 我尝试将其添加到 @INC 但不知何故我无法让它工作......有什么想法或想法吗?非常感谢您的帮助!
最好的,海科
【问题讨论】:
-
您是在 Windows 还是其他操作系统中运行?
-
我在 MacOs Big Sur 上运行