perl: warning: Setting locale failed. 解决


perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_TIME = "zh_CN.UTF-8",
    LC_MONETARY = "zh_CN.UTF-8",
    LC_ADDRESS = "zh_CN.UTF-8",
    LC_TELEPHONE = "zh_CN.UTF-8",
    LC_NAME = "zh_CN.UTF-8",
    LC_MEASUREMENT = "zh_CN.UTF-8",
    LC_IDENTIFICATION = "zh_CN.UTF-8",
    LC_NUMERIC = "zh_CN.UTF-8",
    LC_PAPER = "zh_CN.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

安装软件时,都会去执行 update-locale 命令,用来更新 locale。这个命令是 perl 脚本(可以用 whereis update-locale 查到)

上述警告并不是因为 update-locale 命令错了,而是因为 perl 的配置出了问题。

可以使用以下命令只运行 perl 测试:

$ perl -e exit

perl 使用系统提供的默认 locale zh_CN.UTF-8,但这个值是 ssh 从客户端传递来的,系统其实不知道 zh_CN.UTF-8 该如何处理。

我们安装语言包即可解决问题:

$ apt-get install language-pack-zh-hans


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM