cpan命令给出错误“无法在@INC中找到B.pm”。 [英] cpan command gives the error "Can't locate B.pm in @INC"

查看:195
本文介绍了cpan命令给出错误“无法在@INC中找到B.pm”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


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

  paulzierep @ naproxen:〜$ cpan 
在@INC中找不到B.pm(您可能需要安装B模块)(@ 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 / home / paulzierep) /usr/share/perl/5.22/Safe.pm第34行。
BEGIN失败-编译在/usr/share/perl/5.22/Safe.pm第34行中止。
编译在require处失败/usr/share/perl/5.22/CPAN.pm第56行。
BEGIN失败-在/usr/share/perl/5.22/CPAN.pm第56行中终止编译。
编译在require处失败/usr/share/perl/5.22/App/Cpan.pm第273行。
BEGIN失败-在/usr/share/perl/5.22/App/Cpa中终止编译n.pm第273行。
编译在/ usr / bin / cpan第9行的require中失败。
BEGIN失败-在/ usr / bin / cpan第9行的编译中止。

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


我在Ubuntu 16.04上使用Perl 5.22.1。


更新


所以我将 PERL5LIB PERL5OPT 设置为找到 / usr /lib/x86_64-linux-gnu/perl/5.22.1/B.pm ,并且CPAN运行,但是由于以下错误,我无法安装任何软件


< pre class = lang-none prettyprint-override> cpan [1]> install Log :: Log4perl
读取'/home/paulzierep/.cpan/Metadata'
数据库于2016年9月30日星期五生成,格林尼治标准时间
运行模块'Log :: / home / paulzierep / .cpan / sources / authors / id / M / MS / MSCHILLI / Log-Log4perl-1.47.tar.gz的Log4perl
校验和ok
扫描缓存/ home / paulzierep /.cpan/build尺寸
....................................... .............................................. DONE
'YAML'未安装,不会存储持久状态
使用Makefile.PL配置M / MS / MSCHILLI / Log-Log4perl-1.47.tar.gz
检查工具包是否完整...
看起来不错
拥有/usr/lib/x86_64-linux-gnu/perl/5.22.1
想要/usr/lib/x86_64-linux-gnu/perl/5.22
您的perl和Config.pm似乎有关于他们运行的
体系结构的不同想法。
Perl认为:[5.22.1]
Config表示:[x86_64-linux-gnu-thread-multi]
这可能会或可能不会引起问题。如果在构建此扩展程序时遇到问题,请检查perl
的安装。
生成Unix风格的Makefile
编写用于Log :: Log4perl的Makefile
编写MYMETA.yml和MYMETA.json
MSCHILLI / Log-Log4perl-1.47.tar.gz
/ usr / bin / perl Makefile.PL INSTALLDIRS = site-OK
运行M / MS / MSCHILLI / Log-Log4perl-1.47.tar.gz的make
make:***无规则制作目标文件'/usr/lib/x86_64-linux-gnu/perl/5.22/Config.pm',这是'Makefile'所需的。停止。
MSCHILLI / Log-Log4perl-1.47.tar.gz
/ usr / bin / make-不好
在此命令期间失败:
MSCHILLI / Log-Log4perl-1.47。 tar.gz:不让

所以它解决了问题,给我带来了另一个问题。对这个有什么帮助吗?


那是我得到的:

  paulzierep @ naproxen:〜$ perl -E'对@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 / bin
/ 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 


I wanted to use CPAN to install some Perl packages, but I get the following error when I try to start the 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.

I can't figure out how to install the missing B module without cpan. I guess this should be installed by default.

I'm using Perl 5.22.1 on Ubuntu 16.04.

Update

So I set the PERL5LIB or PERL5OPT to make it find /usr/lib/x86_64-linux-gnu/perl/5.22.1/B.pm, and CPAN runs, but I can not install anything due to the following error

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

So it kind of fixed it and left me with another problem. Any help on this one?

That what I get for:

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

解决方案

I had the same problem. For some unknown reason, the directory /usr/lib/x86_64-linux-gnu/perl was empty. My solution was to reinstall the libperl5.22 package.

sudo apt-get install --reinstall libperl5.22

这篇关于cpan命令给出错误“无法在@INC中找到B.pm”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆