mountain-lion – 如何在Mountain Lion上重新安装Perl内置的Mac OS X?

我4天前更新到Mountain Lion,然后意识到我的perl脚本不再工作了.所以我安装了ActivePerl 5.14(最新版本),因为我认为perl已被删除.安装ActivePerl虽然我的程序仍然无法正常工作:

Warning message:
running command 'perl calc.pl' had status 2 
Can't locate Excel/Writer/XLSX.pm in @INC (@INC contains:    
/Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 
/Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 
/Library/Perl/Updates/5.12.4 /System/Library/Perl/5.12/darwin-thread-multi-2level 
/System/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-
2level /System/Library/Perl/Extras/5.12 .) at test.pl line 3.
BEGIN failed--compilation aborted at calc.pl line 3.

在我键入perl -v的终端中,它显示它使用新安装的ActivePerl.我用sudo clan – >安装Excel :: Writer :: XLSX以安装缺少的模块.但是,它不会为5.12而是为ActivePerl 5.14安装它.

自己的Mac OS X Perl接缝要安装在这里:

bash-3.2$ls /Library/Perl/
5.10    5.12    Updates
bash-3.2$ls /System/Library/Perl/
5.10    5.12    Extras  lib
bash-3.2$

这里还有一个版本:

bash-3.2$ls /opt/local/lib/perl5/
5.12.4      site_perl   vendor_perl

我认为最好是通过运行其卸载程序来删除ActivePerl.我这样做了,并删除了5.12.4以及/ opt / local / lib / perl5中的site_perl目录.

然后我想用cpan重新安装XLSX :: Writer模块.我认为它然后安装到旧的perl目录中.但是,运行cpan现在会导致以下错误:

bash-3.2$sudo cpan
Can't locate strict.pm in @INC (@INC contains:    
/opt/local/lib/perl5/site_perl/5.12.4/darwin-multi-2level 
/opt/local/lib/perl5/site_perl/5.12.4 
/opt/local/lib/perl5/vendor_perl/5.12.4/darwin-multi-2level 
/opt/local/lib/perl5/vendor_perl/5.12.4 /opt/local/lib/perl5/5.12.4/darwin-multi-
2level /opt/local/lib/perl5/5.12.4 /opt/local/lib/perl5/site_perl 
/opt/local/lib/perl5/vendor_perl/5.12.3/darwin-multi-2level 
/opt/local/lib/perl5/vendor_perl/5.12.3 /opt/local/lib/perl5/vendor_perl .) at 
/opt/local/bin/cpan line 5.
BEGIN failed--compilation aborted at /opt/local/bin/cpan line 5.

我现在不知道该怎么办.我认为我能做的最好的可能是重新安装Mac OS X自己的Perl,怎么做?

最佳答案
我在另一个网站上找到了以下命令

$sudo perl -MCPAN -e’CPAN :: Shell-> notest(install => CPAN :: Shell-> r)’

这更新了我的所有perl模块,一切都恢复正常.不知道为什么或什么,但不关心它现在有效.

转载注明原文:mountain-lion – 如何在Mountain Lion上重新安装Perl内置的Mac OS X? - 代码日志