perl混了,cpan装不上

Perl mixed up, Cpan can not install

你好,我想通过 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

这通常发生在您调用的 perl 查找其他 perl 留下的库目录时。部分错误为:

Your perl and your Config.pm seem to have different ideas about the architecture they are running on.

从那里开始调查。找出它在哪里找到不匹配的 Config.pm 并解决该问题。 运行 perl -V 查看 @INC 中的内容会有帮助。

除此之外,您还必须告诉我们更多关于您的设置的信息。

你真的应该再看看你之前问题的评论

Why does the default cpan on Ubuntu 16.04 give the error "Can't locate B.pm in @INC"?

我观察到您的@INC最后位置

包含您的主目录/home/paulzierep

我问是否设置了环境变量PERL5LIBPERL5OPT,你的回答只有

I changed the PERL5LIB environement var to usr/lib/x86_64-linux-gnu/perl/5.22.1/ and indeed I am able to open the cpan shell, but ones I try an install now, I get: Your perl and your Config.pm seem to have different ideas about the architecture they are running on

我不知道你做了什么让你的主目录在@INC结束。 PERL5LIB-I 命令行选项都使用 unshift 而不是 push,并将位置添加到 start @INC数组

默认情况下,可以使用 @INC 中的主目录构建一个新的 perl 映像,但如果那是您所做的,您肯定会这么说?

让我说清楚:PERL5LIBPERL5OPT 应该是 undefined perl

的正常操作

您之前提到过向 PERL5LIB 添加一个您不应该添加的目录。请撤消此更改,此问题将会消失。

所以在删除perl相关的环境变量后,我又回到了之前的错误post cpan command gives the error "Can't locate B.pm in @INC"。 我设法解决了,所以我假设这也回答了这个 post。