在@INC中找不到Text / Soundex.pm

时间:2019-04-19 23:20:29

标签: perl

我正在安装repeatsmasker,它似乎可以正常工作,因为它显示“恭喜!RepeatMasker现在可以使用了。”  但是当我运行它时,它报告“找不到Text / Soundex.pm ...”。因此我通过“ sudo cpan Text :: Soundex”安装了该模块,最后它告诉我“ Text :: Soundex是最新的(3.05)”。似乎已经安装了该模块,但是RepeatMasker仍然存在相同的问题,如下面的代码所示:

fragua@picci:~/RM/RepeatMasker$ sudo cpan Text::Soundex
Loading internal null logger. Install Log::Log4perl for logging messages
Reading '/home/fragua/.cpan/Metadata'
 Database was generated on Fri, 19 Apr 2019 22:17:03 GMT
Text::Soundex is up to date (3.05).

fragua@picci:~/RM/RepeatMasker$ ./RepeatMasker -s -lib /home/fragua/RepeatScout-1.0.5/ObiINK5k_repeats_filtered1.fasta /home/fragua/Documenti/Workdirectory/ObiINC5k.fa
Can't locate Text/Soundex.pm in @INC (you may need to install the Text::Soundex module) (@INC contains: /home/fragua/RM/RepeatMasker /home/fragua/perl5/lib/perl5 /home/fragua/anaconda/lib/site_perl/5.26.2/x86_64-linux-thread-multi /home/fragua/anaconda/lib/site_perl/5.26.2 /home/fragua/anaconda/lib/5.26.2/x86_64-linux-thread-multi /home/fragua/anaconda/lib/5.26.2 .) at /home/fragua/RM/RepeatMasker/Taxonomy.pm line 80.
BEGIN failed--compilation aborted at /home/fragua/RM/RepeatMasker/Taxonomy.pm line 80.
Compilation failed in require at ./RepeatMasker line 310.
BEGIN failed--compilation aborted at ./RepeatMasker line 310.

我将RepeatMasker安装在另一台计算机上没有问题,但是我不知道为什么现在遇到这个问题

1 个答案:

答案 0 :(得分:2)

您已经安装了两个Perl版本:

  • /usr/bin/perl
  • /home/fragua/anaconda/bin/perl

/home/fragua/anaconda/bin/perl首先在您的PATH中。这意味着带有以下shebang(#!)行的程序将使用/home/fragua/anaconda/bin/perl

#!/usr/bin/env perl

RepeatMasker就是这样的程序。

这一切都很好。

问题

/home/fragua/anaconda/bin包含/home/fragua/anaconda/bin/perl安装的脚本。在这些脚本的安装过程中,应重写这些脚本的shebang行以指定/home/fragua/anaconda/bin/perl

但是,/home/fragua/anaconda/bin/cpan的shebang行引用了/usr/bin/perl。这意味着使用/home/fragua/anaconda/bin/cpan将为/usr/bin/perl而非/home/fragua/anaconda/bin/perl安装模块。

解决方法

您可以避免依赖shebang行,并明确指定正确的perl

/home/fragua/anaconda/bin/perl /home/fragua/anaconda/bin/cpan Text::Soundex

或者,根据您的$PATH

perl /home/fragua/anaconda/bin/cpan Text::Soundex

修复

要持续解决此问题,需要将脚本的shebang行更改为应该的样子。在/home/fragua/anaconda/bin中的每个文件(尤其是cpan中的文件)中,替换

#!/usr/bin/perl

#!/home/fragua/anaconda/bin/perl

您可以使用以下方法(对更改后的文件进行备份):

perl -0777ne'print "$ARGV\n" if m{^#!\s*/usr/bin/perl\b}' /home/fragua/anaconda/bin/* \
   | xargs perl -i~ -0777pe's{^#!\s*/usr/bin/perl\b}{#!/home/fragua/anaconda/bin/perl}'