无法在Perl中找到DBI.pm模块

无法在Perl中找到DBI.pm模块

问题描述:

我使用的是CentOS,我已经安装Perl 5.20和Perl 5.10默认存在。

I am using CentOS, and I have installed Perl 5.20 and Perl 5.10 was present by default.

我使用Perl 5.20版本来执行Perl代码

I am using the Perl 5.20 version to execute the Perl code

我试图使用DBI模块并收到此错误

I am trying to use the DBI module and get this error

[root@localhost ~]#perl -e 'use DBI;'
Can't locate DBI.pm in @INC (you may need to install the DBI module) (@INC contains: /usr/local/lib/perl5/site_perl/5.20.1/i686-linux /usr/local/lib/perl5/site_perl/5.20.1 /usr/local/lib/perl5/5.20.1/i686-linux /usr/local/lib/perl5/5.20.1 .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.




  • 如何检查所有已安装的Perl版本?

    • How to check for all installed versions of Perl?

      是否安装了DBI或任何模块?

      How do I check whether the DBI or any module is installed?

      如何解决此错误以便我可以使用DBI模块?

      How to resolve this error so that I can use DBI module?


如何检查所有已安装的perl版本?

How to check for all installed versions of perl?




  • 正如Sobrique在注释中建议的,你不应该触摸系统perl。我建议您使用 perlbrew 。使用perlbrew你可以从本地用户安装不同版本的perl,并使用perlbrew检查perl的所有安装版本只是 $ perlbrew -l 。

    • As Sobrique suggested in comments, you should never touch system perl. I'd suggest using perlbrew. With perlbrew you can install different versions of perl from local user, and to check all installed versions of perl using perlbrew just do $ perlbrew -l.

    • 如何在执行程序时在它们之间切换?

      how to switch between them while executing a program?

      安装多个perls

$ perlbrew -v install perl-5.20.0
$ perlbrew -v install perl-5.13.4

在他们之间切换

$ perlbrew switch perl-5.20.0
$ perlbrew switch perl-5.13.4

有关详细信息,请参阅此文章:使用App :: perlbrew和App :: cpanminus安装多个Perls

See this article for more details: Installing Multiple Perls with App::perlbrew and App::cpanminus


是否安装了DBI或任何模块?

How do I check if DBI or any module is installed?