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
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞