我在语言环境设置方面遇到了一些问题。当我在终端中输入语言环境时,我收到这样的错误:
$locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
我不知道我做错了什么,但我需要你们的帮助。当我在终端中键入 locale-gen 时,出现错误:
Generating locales (this might take a while)...
en_US.UTF-8...failed to set locale!
[error] cannot open locale definition file `en_GB': No such file or directory
done
Generation complete.
我找到了一个解决方案,我自己想通了。我删除了最后一行 /etc/locale.gen 中的 # 。在我删除之前就像下面一样:
# aa_DJ ISO-8859-1
# aa_DJ.UTF-8 UTF-8
# aa_ER UTF-8
# aa_ER@saaho UTF-8
...
# zu_ZA ISO-8859-1
# zu_ZA.UTF-8 UTF-8
en_US.UTF-8 UTF-8
我像这样更改了最后一行:
# en_US.UTF-8 UTF-8
我不知道我是否做错了什么,但是当我这样做时,错误就解决了。如果我做错了什么,请告诉我。之后我尝试重新配置语言环境,但是当我尝试这样做时出现另一个错误:
$sudo dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "",
LC_ALL = "en_US.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_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_MESSAGES to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory
当我尝试更改 LC_ALL 时,我又遇到了一个错误:
$export LC_ALL="en_US.UTF-8 UTF-8"
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
我收到一个错误,但 LC_ALL 发生了变化。我不知道我的语言环境设置发生了什么,但似乎我真的搞砸了。我应该怎么做才能修复所有这些?
使用以下方法确保您的语言环境存在:
如果您没有在列表中看到您的语言环境,请使用:
然后通过以下方式将您的语言环境更新为现有语言环境:
通过以下方式应用更改:
我的语言环境:
为当前会话设置语言环境:
你也可以试试