执行 sudo 操作时出现语言环境错误

执行 sudo 操作时出现语言环境错误

当我执行一些超级用户操作(例如升级系统)时,我会收到以下警告:

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

你知道我该如何摆脱它吗?我想要 en_US 系统

答案1

用于sudo vim /etc/default/locale添加缺失的行:

LANGUAGE="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

然后重新启动系统,一切都会正常。

答案2

如果您想要所有数字格式、日期/时间格式等都采用美国风格,您可以编辑该/etc/default/locale文件并使其仅包含行

LANG=en_US.UTF-8

否则,您可以生成缺失的德语区域设置:

sudo locale-gen de_DE.UTF-8

相关内容