您好我想通过cpan安装软件包,但是我收到以下错误:
cpan[1]> install Log::Log4perl
Reading '/home/paulzierep/.cpan/Metadata'
Database was generated on Fri, 30 Sep 2016 06:29:02 GMT
Running install for module 'Log::Log4perl'
Checksum for /home/paulzierep/.cpan/sources/authors/id/M/MS/MSCHILLI/Log-Log4perl-1.47.tar.gz ok
Scanning cache /home/paulzierep/.cpan/build for sizes
............................................................................DONE
'YAML' not installed, will not store persistent state
Configuring M/MS/MSCHILLI/Log-Log4perl-1.47.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Have /usr/lib/x86_64-linux-gnu/perl/5.22.1
Want /usr/lib/x86_64-linux-gnu/perl/5.22
Your perl and your Config.pm seem to have different ideas about the
architecture they are running on.
Perl thinks: [5.22.1]
Config says: [x86_64-linux-gnu-thread-multi]
This may or may not cause problems. Please check your installation of perl
if you have problems building this extension.
Generating a Unix-style Makefile
Writing Makefile for Log::Log4perl
Writing MYMETA.yml and MYMETA.json
MSCHILLI/Log-Log4perl-1.47.tar.gz
/usr/bin/perl Makefile.PL INSTALLDIRS=site -- OK
Running make for M/MS/MSCHILLI/Log-Log4perl-1.47.tar.gz
make: *** No rule to make target '/usr/lib/x86_64-linux-gnu/perl/5.22/Config.pm', needed by 'Makefile'. Stop.
MSCHILLI/Log-Log4perl-1.47.tar.gz
/usr/bin/make -- NOT OK
Failed during this command:
MSCHILLI/Log-Log4perl-1.47.tar.gz : make NO
它说要检查我的perl安装,即:
perl --version
This is perl 5, version 22, subversion 1 (v5.22.1) built for x86_64-linux-gnu-thread-multi
(with 58 registered patches, see perl -V for more detail)
Copyright 1987-2015, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
此处@INC
:
/usr/lib/x86_64-linux-gnu/perl/5.22.1/ /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
我得到的是:
paulzierep@naproxen:~$ perl -E 'say for @INC'
/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
.
paulzierep@naproxen:/home$ perl -MFile::Spec -E 'say for File::Spec->path'
/home/paulzierep/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/usr/local/games
/snap/bin
答案 0 :(得分:4)
这通常发生在你调用的perl在其他perls留下的库目录中查找时。部分错误是:
您的perl和您的Config.pm似乎对此有不同的看法 他们正在运行的架构。
开始在那里调查。找出它找到不匹配的Config.pm的位置并解决该问题。运行perl -V
以查看@INC
中的内容会有所帮助。
除此之外,您还必须告诉我们有关您的设置的更多信息。
答案 1 :(得分:1)
您应该再看看上一个问题的评论
Why does the default cpan on Ubuntu 16.04 give the error "Can't locate B.pm in @INC"?
我发现您的@INC
包含 last 位置中的主目录/home/paulzierep
我询问是否设置了环境变量PERL5LIB
或PERL5OPT
,并且您的唯一回复是
我将PERL5LIB environement var更改为usr / lib / x86_64-linux-gnu / perl / 5.22.1 /实际上我可以打开cpan shell,但我现在尝试安装,我得到:你的perl你的Config.pm似乎对它们运行的架构有不同的看法
我不知道您在@INC
末尾获取主目录所做的工作。 PERL5LIB
和-I
命令行选项都使用unshift
而不是push
,并将位置添加到@INC
的 start } array
默认情况下,很可能在@INC
中使用您的主目录构建一个新的perl映像,但如果您已经这样做了,那么您肯定会这样说过吗?
让我明确一点:PERL5LIB
和PERL5OPT
应该未定义以进行perl的正常操作
答案 2 :(得分:1)
您之前曾提到过添加一个您不应添加的PERL5LIB
目录。请撤消此更改,此问题将消失。
答案 3 :(得分:0)
因此,在删除与perl相关的环境变量后,我回到了之前的错误帖子cpan command gives the error "Can't locate B.pm in @INC"。 我设法解决了,所以我认为这也回答了这篇文章。