perl: warning: Setting locale failed.

转载自:http://blog.chinaunix.net/uid-27570589-id-3691390.html
运行某些perl 编写的脚本时 会报出一下的错误:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "zh_CN.ZHS16GBK"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Can't locate warning.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at ./perl_tac line 2.
BEGIN failed--compilation aborted at ./perl_tac line 2.

以上问题分为两部分 (1)perl: warning: Falling back to the standard locale ("C"). 到这一句 为分界线,这个问题的解决方式
                                  因为我是在普通用户下运行的  直接改当前用户的环境变量就可以 vi.bash_profile  在最后输入 export LC_ALL=C
或者
   vi /root/.bashrc
再最底部加上
   export LC_ALL=C
或者直接运行
   echo "export LC_ALL=C" >> /root/.bashrc
然后执行一下:
   source /root/.bashrc 
                              (2)  can't locate warning.pm in @INC  不能定位warning 模块  
                                如何查看perl 安装过的模块  find `perl -e 'print "@INC"'` -name "*.pm"

                               后来发现 是use warnings 这忘记写s 了  

你可能感兴趣的:(ubuntu,perl)