在 Raspberry Pi3 上设置 LOCALE

在 Raspberry Pi3 上设置 LOCALE

我使用 raspberry 很多年了,使用 Linux 也很多年了... 尝试在我的 rpi 中安装 Docker 时出现错误,这可能与 LOCALE 安装有关。问题是这样的:

apt-listchanges: Can't set locale; make sure $LC_* and $LANG are correct!
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

我已经尝试了很多指南,但问题仍然存在。

有什么帮助吗?

答案1

编辑/etc/locale.gen然后取消注释以下行:

en_GB.UTF-8 UTF-8

跑步:

sudo locale-gen en_GB.UTF-8 UTF-8
sudo update-locale en_GB.UTF-8 UTF-8
export LANGUAGE=en_GB.UTF-8
export LC_ALL=en_GB.UTF-8

验证一下;

locale

您可能会获得:

LANG=en_GB.UTF-8
LANGUAGE=en_GB.UTF-8
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=en_GB.UTF-8

并做了 !!!

答案2

请参阅此处发布的解决方案:

https://unix.stackexchange.com/questions/269159/problem-of-cant-set-locale-make-sure-lc-and-lang-are-correct

简短回答:dpkg-reconfigure locales以 root 身份运行,在列表中选择您想要的语言环境(使用您的设置,您需要 en_GB 和 en_US.UTF-8 - 我建议也选择 en_US 和 en_GB.UTF-8),然后按。

相关内容