不能在线安装perl ----Can't locate CPAN.pm in @INC的解决办法

perl -MCPAN -e 'install "模块名称"'

我在在线安装perl 模块时,发现有这样的问题。应该是说没有安装CPAN这个服务吧。在网站找到一些资料

 

1、执行perl -MCPAN -e shell出错,提示如下:

[root@fc9 ~]# perl -MCPAN -e shell
Can't locate CPAN.pm in @INC (@INC contains: /usr/lib/perl5/5.10.0/i386-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.10.0 /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/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /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 .).
BEGIN failed--compilation aborted.

2、到cpan的官方站点下载CPAN模块

http://search.cpan.org/~andk/CPAN-1.9205/lib/CPAN.pm

[root@fc9 ~]#wget http://search.cpan.org/CPAN/authors/id/A/AN/ANDK/CPAN-1.9205.tar.gz

3、解压,编绎,安装

[root@fc9 ~]# tar -zxvf CPAN-1.9205.tar.gz

[root@fc9 ~]# cd CPAN-1.9205

[root@fc9 CPAN-1.9205]# perl Makefile.PL

[root@fc9 CPAN-1.9205]# make

[root@fc9 CPAN-1.9205]# make install

4、成功进入CPAN的shell模式

[root@fc9 CPAN-1.9205]# perl -MCPAN -e shell

你可能感兴趣的:(不能在线安装perl ----Can't locate CPAN.pm in @INC的解决办法)