gpt4 book ai didi

perl - cpan 命令给出错误 "Can' t locate B.pm in @INC"

转载 作者:行者123 更新时间:2023-12-04 18:26:09 25 4
gpt4 key购买 nike

我想使用 CPAN 安装一些 Perl 包,但是当我尝试启动 CPAN shell 时出现以下错误:

paulzierep@naproxen:~$ cpan
Can't locate B.pm in @INC (you may need to install the B module) (@INC contains: /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 /home/paulzierep) at /usr/share/perl/5.22/Safe.pm line 34.
BEGIN failed--compilation aborted at /usr/share/perl/5.22/Safe.pm line 34.
Compilation failed in require at /usr/share/perl/5.22/CPAN.pm line 56.
BEGIN failed--compilation aborted at /usr/share/perl/5.22/CPAN.pm line 56.
Compilation failed in require at /usr/share/perl/5.22/App/Cpan.pm line 273.
BEGIN failed--compilation aborted at /usr/share/perl/5.22/App/Cpan.pm line 273.
Compilation failed in require at /usr/bin/cpan line 9.
BEGIN failed--compilation aborted at /usr/bin/cpan line 9.

我不知道如何在没有 cpan 的情况下安装缺少的 B 模块。我想这应该是默认安装的。

我在 Ubuntu 16.04 上使用 Perl 5.22.1。

更新

所以我设置了 PERL5LIBPERL5OPT 让它找到 /usr/lib/x86_64-linux-gnu/perl/5.22.1/B。 pm,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

所以它有点修复它并给我留下了另一个问题。在这方面有什么帮助吗?

我得到的是:

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

最佳答案

我遇到了同样的问题。由于某些未知原因,目录 /usr/lib/x86_64-linux-gnu/perl 是空的。我的解决方案是重新安装 libperl5.22 包。

sudo apt-get install --reinstall libperl5.22

关于perl - cpan 命令给出错误 "Can' t locate B.pm in @INC",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39773525/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com