【问题标题】:Perl mixed up, Cpan can not installPerl 搞混了,Cpan 无法安装
【发布时间】:2017-02-09 02:59:57
【问题描述】:

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

【问题讨论】:

  • 由于这个问题与编程无关,而是与系统配置有关,我建议将此问题提交给 SO 网络上与系统相关的站点之一,例如 unix/linux、serverfault 或(关于那个标签)askubuntu.
  • @syck 这个问题很好。来自help center:“如果您的问题一般涵盖……特定的编程问题,或软件算法,或程序员常用的软件工具;并且是软件独有的实用、可回答的问题发展......那么你来对地方提出你的问题了!”
  • 这与你asked about yesterday 因找不到 B.pm 而窒息的 cpan 版本相同吗?如果是这样,你应该edit你的问题来说明你是如何解决这个问题的。
  • @ThisSuitIsBlack 确实不是,事实上我在这里很新,不知道如何编辑 quastion。
  • 只需单击问题底部的“编辑”按钮(或我上次评论中的编辑链接)。使用附加信息编辑您的问题是个好主意,因为 cmets 可能会在一段时间后变得笨拙。例如,您可以添加 brian d foy 询问的信息以及指向昨天问题的链接以及对您目前所做工作的解释。

标签: perl cpan ubuntu-16.04


【解决方案1】:

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

您的 perl 和您的 Config.pm 似乎对 他们正在运行的架构。

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

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

【讨论】:

  • \@INC 在 \@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 在/usr/lib/x86_64-linux-中找到Config.pm文件gnu/perl/5.22.1/ 只是因为我将路径放入 PERL5LIB="/usr/lib/x86_64-linux-gnu/perl/5.22.1/" 。如果我不设置环境,它根本无法运行 cpan。
  • @PaulZierep PERL5LIB 设置会导致您的问题;不知何故,您正在执行的 cpan 命令(您没有显示 :( )正在使用不同的 perl。试试perl -MCPAN -eshell
  • @ysth 我删除了 PERL5LIB 路径,但是我根本无法运行 cpan:错误无法在 \@INC 中找到 B.pm,就像我的旧帖子一样:stackoverflow.com/questions/39773525/…
  • @PaulZierep 你知道perl -MCPAN -eshell 吗?在我看来,当您仅输入 cpan 时,它使用的 perl 与您输入 perl 时使用的 perl 不同,并且其他 perl 不完整。
  • @ysth 我现在不在办公室,会在星期二(星期一的德国假期)调查这个问题,谢谢。
【解决方案2】:

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

【讨论】:

  • 通过扭转这一点,我在尝试打开 cpan 时出现以前的错误:请参见此处:stackoverflow.com/questions/39773525/…
  • @Paul Zierep,当然可以。您仍然没有修复该错误。我只是告诉你如何解决这个问题。
【解决方案3】:

你真的应该再看看你上一个问题的 cmets

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

我观察到您的@INC最后位置包含您的主目录/home/paulzierep

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

我将 PERL5LIB 环境变量更改为 usr/lib/x86_64-linux-gnu/perl/5.22.1/ 并且确实可以打开 cpan shell,但是我现在尝试安装的那些,我得到:你的 perl并且您的 Config.pm 似乎对它们运行的​​架构有不同的想法

我不知道你做了什么来获得@INC 末尾的主目录。 PERL5LIB-I 命令行选项都使用unshift 而不是push,并将位置添加到@INC 数组的开始

默认情况下,很有可能使用您的主目录在@INC 中构建一个新的 perl 映像,但如果您这样做了,您肯定会这么说吗?

让我明确一点:PERL5LIBPERL5OPT 对于 perl 的正常操作应该是 undefined

【讨论】:

  • 抱歉,如果不清楚,PERL5LIB 或 PERL5OPT 未设置。我确定我没有构建新的 perl 映像,因为我不知道该怎么做。我也不知道为什么我的主目录在@INC 中。
  • 所以如果 PERL5LIB 和 PERL5OPT 未定义,can't locate B.pm 错误仍然存​​在。
  • @PaulZierep:您之前的问题显示/home/paulzierep 在perl 的@INC 数组中。似乎有人叫 Paul Zierep 做到了这一点。在确保清除所有PERL* 环境变量后运行perl -E 'say for @INC' 时会看到什么?
  • @PaulZierep:另外,perl -MFile::Spec -E 'say for File::Spec->path' 是什么意思
  • 这听起来很合理,但我仍然不明白我怎么能做到这一点,我现在不在办公室,将在星期二发布 perl -E say 'for \@INC' 的结果(德国周一放假),谢谢
【解决方案4】:

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

【讨论】:

    猜你喜欢
    • 2018-02-17
    • 2020-07-16
    • 2020-01-23
    • 2020-05-07
    • 2011-06-15
    • 2017-08-28
    • 1970-01-01
    • 2019-04-11
    • 2017-03-19
    相关资源
    最近更新 更多