使用cpan安装后仍未找到Perl模块

问题描述:

我无法使一个名为RepeatMasker的程序正常工作。我收到以下错误:使用cpan安装后仍未找到Perl模块

~$ RepeatMasker 
Can't locate Text/Soundex.pm in @INC (you may need to 
install the Text::Soundex module) (@INC contains: /home/florian/Masterarbeit/RepeatMasker 
/etc/perl 
/usr/local/lib/x86_64-linux-gnu/perl/5.22.1 
/usr/local/share/perl/5.22.1 
/usr/lib/x86_64-linux-gnu/perl5/5.22 
/usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 
/usr/share/perl/5.22 /usr/local/lib/site_perl 
/usr/lib/x86_64-linux-gnu/perl-base .) 
at /home/florian/Masterarbeit/RepeatMasker/Taxonomy.pm line 83. 

BEGIN failed--compilation aborted at /home/florian/Masterarbeit/RepeatMasker/Taxonomy.pm line 83. 
Compilation failed in require at /home/florian/Masterarbeit/RepeatMasker/RepeatMasker line 313. 
BEGIN failed--compilation aborted at /home/florian/Masterarbeit/RepeatMasker/RepeatMasker line 313. 

现在,我试图通过CPAN/cpanm安装缺少的模块:

~$ cpan install Text::Soundex 
Loading internal null logger. Install Log::Log4perl for logging messages 
CPAN: Storable loaded ok (v2.53_01) 
Reading '/home/florian/.cpan/Metadata' 
    Database was generated on Thu, 20 Apr 2017 11:41:02 GMT 
Running install for module 'Text::Soundex' 
CPAN: Digest::SHA loaded ok (v5.95) 
CPAN: Compress::Zlib loaded ok (v2.068) 
Checksum for /home/florian/.cpan/sources/authors/id/R/RJ/RJBS/Text-Soundex-3.05.tar.gz ok 
CPAN: File::Temp loaded ok (v0.2304) 
CPAN: YAML loaded ok (v1.15) 
CPAN: CPAN::Meta::Requirements loaded ok (v2.140) 
CPAN: Parse::CPAN::Meta loaded ok (v1.4414) 
CPAN: CPAN::Meta loaded ok (v2.150005) 
CPAN: Module::CoreList loaded ok (v5.20151213) 
Configuring R/RJ/RJBS/Text-Soundex-3.05.tar.gz with Makefile.PL 
WARNING: Option INSTALLDIRS=site was not recognized. (ignoring) 
The XS code will be compiled. 
Checking if your kit is complete... 
Looks good 
Generating a Unix-style Makefile 
Writing Makefile for Text::Soundex 
Writing MYMETA.yml and MYMETA.json 
    RJBS/Text-Soundex-3.05.tar.gz 
    /usr/bin/perl Makefile.PL INSTALLDIRS=site -- OK 
Running make for R/RJ/RJBS/Text-Soundex-3.05.tar.gz 
cp Soundex.pm blib/lib/Text/Soundex.pm 
Running Mkbootstrap for Text::Soundex() 
chmod 644 "Soundex.bs" 
"/usr/bin/perl" "/usr/share/perl/5.22/ExtUtils/xsubpp" -typemap "/usr/share/perl/5.22/ExtUtils/typemap" Soundex.xs > Soundex.xsc && mv Soundex.xsc Soundex.c 
x86_64-linux-gnu-gcc -c -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -DVERSION=\"3.05\" -DXS_VERSION=\"3.05\" -fPIC "-I/usr/lib/x86_64-linux-gnu/perl/5.22/CORE" Soundex.c 
rm -f blib/arch/auto/Text/Soundex/Soundex.so 
x86_64-linux-gnu-gcc -shared -L/usr/local/lib -fstack-protector-strong Soundex.o -o blib/arch/auto/Text/Soundex/Soundex.so \ 
     \ 

chmod 755 blib/arch/auto/Text/Soundex/Soundex.so 
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Soundex.bs blib/arch/auto/Text/Soundex/Soundex.bs 644 
Manifying 1 pod document 
    RJBS/Text-Soundex-3.05.tar.gz 
    /usr/bin/make -- OK 
Running make test 
Running Mkbootstrap for Text::Soundex() 
chmod 644 "Soundex.bs" 
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t 
t/basic.t .. ok  
All tests successful. 
Files=1, Tests=18, 0 wallclock secs (0.01 usr + 0.00 sys = 0.01 CPU) 
Result: PASS 
    RJBS/Text-Soundex-3.05.tar.gz 
    /usr/bin/make test -- OK 
Running make install 
Manifying 1 pod document 
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree 
Installing /home/florian/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/auto/Text/Soundex/Soundex.so 
Appending installation info to /home/florian/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/perllocal.pod 
    RJBS/Text-Soundex-3.05.tar.gz 
    /usr/bin/make install -- OK 

似乎它的工作。但我仍然得到上面的同样的错误。我很迷茫,它是否安装在错误的位置?哪里?

+2

确保'cpan'和'perl'是同一Perl安装。调用'哪个perl'和'哪个cpan'开始。也可以用@ perl -E'@ INC''来看'@ INC'。 'cpan'安装你的模块的路径在那里? – simbabque

+0

如何查看cpan安装模块的位置? cpan/perl指向'/ usr/bin/perl','/ usr/bin/cpan' – voiDnyx

您已配置CPAN正在将模块安装在非标准位置(/home/florian/perl5/lib/perl5),但您没有告诉Perl在那里寻找模块。

export PERL5LIB=/home/florian/perl5/lib/perl5 

use lib qw(/home/florian/perl5/lib/perl5); 
+0

我试过了,但仍然得到相同的错误。 '〜$ echo $ PERL5LIB /home/florian/perl5/lib'(也是@INC包含'/ home/florian/perl5/lib',所以它应该找到它吗?) – voiDnyx

+2

包含路径是正确的一个目录更深一层:'/ home/florian/perl5/lib/perl5' – daxim

+0

谢谢,这个修好了:)。在旁注中,我如何重置cpan以安装到默认位置? – voiDnyx