安装模块后无法在@INC中找到perl模块

时间:2019-03-05 23:17:57

标签: perl

我真的很不熟悉perl,并试图在apache2上使用CentOS 7上的BioPerl模块。成功安装模块后,该程序仍然抱怨无法在@INC中找到Bio / SeqIO.pm。

完整错误跟踪:

Cant locate Bio/SeqIO.pm in @INC (@INC contains: .. ../ /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at superpose/seqAlign.pm line 39.
BEGIN failed--compilation aborted at superpose/seqAlign.pm line 39.
Compilation failed in require at superpose/superposeController.pm line 38.
BEGIN failed--compilation aborted at superpose/superposeController.pm line 38.
Compilation failed in require at /var/www/cgi-bin/superpose.cgi line 11.
BEGIN failed--compilation aborted at /var/www/cgi-bin/superpose.cgi line 11.

这是我找到bioperl模块的位置:

/root/.cpan/build/BioPerl-1.007002-oajj3K/Bio
/root/.cpan/build/BioPerl-1.007002-oajj3K/blib/lib/Bio
/root/perl5/lib/perl5/x86_64-linux-thread-multi/auto/Bio
/root/perl5/lib/perl5/Bio
/root/.cpanm/work/1551466691.17906/BioPerl-1.007002/Bio
/root/.cpanm/work/1551466691.17906/BioPerl-1.007002/blib/lib/Bio
/root/.cpanm/work/1551734157.15167/BioPerl-1.007002/Bio
/root/.cpanm/work/1551734157.15167/BioPerl-1.007002/blib/lib/Bio
/root/.cpanm/work/1551825394.27587/BioPerl-1.007002/Bio
/root/.cpanm/work/1551825394.27587/BioPerl-1.007002/blib/lib/Bio

@INC和%ENV来自     perl -V

%ENV:
PERL5LIB="/root/perl5/lib/perl5:"
PERL_LOCAL_LIB_ROOT=":/root/perl5"
PERL_MB_OPT="--install_base /root/perl5"
PERL_MM_OPT="INSTALL_BASE=/root/perl5"
@INC:
/root/perl5/lib/perl5/5.16.3/x86_64-linux-thread-multi
/root/perl5/lib/perl5/5.16.3
/root/perl5/lib/perl5/x86_64-linux-thread-multi
/root/perl5/lib/perl5
/usr/local/lib64/perl5
/usr/local/share/perl5
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5

我意识到我的@INC不包含“ / root / perl5 / lib / perl5 / Bio”的路径,但是我认为只要PERL5LIB包含“ / root / perl5 / lib / perl5”,它就应该能够找到模块。

对于seqAlign.pm脚本,它像这样链接perl库:

....
use lib qw(..);
use strict;
use Data::Dumper;

use Bio::SeqIO;
use Bio::PrimarySeq;
.... 

感谢帮助!

1 个答案:

答案 0 :(得分:1)

您证明了将PERL5LIB设置为/root/perl5/lib/perl5会使以下内容优先放置到@INC

/root/perl5/lib/perl5/5.16.3/x86_64-linux-thread-multi
/root/perl5/lib/perl5/5.16.3
/root/perl5/lib/perl5/x86_64-linux-thread-multi
/root/perl5/lib/perl5

但是,提供错误消息的@INC的{​​{1}}中没有这些,因此在您运行的环境中显然没有将perl设置为PERL5LIB您的脚本。在那种环境中适当地设置它可以解决您的问题。