4
#!/usr/bin/perl
use strict;
use DBI;
use Text::CSV_XS;

每当我执行我的程序时,我都会收到以下错误。我已经正确安装了模块,但我不知道为什么会出现这个错误。

Can't locate Text/CSV_XS.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/WINAST/DHL/AGI/M_GET_AGENT_update.pl line 9.
BEGIN failed--compilation aborted at /usr/WINAST/DHL/AGI/M_GET_AGENT_update.pl

[root@localhost]# perldoc -l Text::CSV_XS.pm
/usr/local/lib/perl5/site_perl/5.8.8/x86_64-linux/Text/CSV_XS.pm

[root@localhost]# instmodsh
Available commands are:
   l            - List all installed modules
   m <module>   - Select a module
   q            - Quit the program
cmd? l
Installed modules are:
   DBI
   Date::Parse
   DateTime::Format::DBI
   My::Math
   Perl
   Test::Inter
   Test::NoWarnings
   Test::Tester
   Text::CSV_XS
   Time::Piece
4

1 回答 1

21

在我看来,您的 /usr/bin/perl 和 /usr/local/bin/perl 不是一回事。

更改 shebang 以使用已安装 Text::CSV_XS 的 Perl,或perl通过发出以下命令为您正在使用的 Perl 安装 Text::CSV_XS:

 /usr/bin/perl -MCPAN -e'install Text::CSV_XS'
于 2013-06-06T17:44:26.907 回答