Just 做 IT

求知若饥 虚心若愚 안년하세요 (•‾̑⌣‾̑•)

locale: Cannot set LC_ALL to default locale: No such file or directory

2 years ago 0

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en",
LC_ALL = (unset),
LC_PAPER = "zh_CN.UTF-8",
LC_ADDRESS = "zh_CN.UTF-8",
LC_MONETARY = "zh_CN.UTF-8",
LC_NUMERIC = "zh_CN.UTF-8",
LC_TELEPHONE = "zh_CN.UTF-8",
LC_IDENTIFICATION = "zh_CN.UTF-8",
LC_MEASUREMENT = "zh_CN.UTF-8",
LC_TIME = "zh_CN.UTF-8",
LC_NAME = "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").
locale: Cannot set LC_ALL to default locale: No such file or directory
网上普遍的解决方法都是:修改/etc/default/locale,增加:

LC_ALL="C"
确实能解决这个问题,但是似乎我有一台不出错的服务器上,并没有设置LC_ALL。强制设置LC_ALL有点粗暴,一定有更好的解决方法。

研究了一下,最佳方法是,修改/var/lib/locales/supported.d/local,追加一行:

zh_CN.UTF-8 UTF-8
然后:

sudo locale-gen
sudo dpkg-reconfigure locales
就完美解决了。

Write a Comment