我在 linode 上安装 Dropbox 失败,并出现以下错误:
ValueError: unknown locale: UTF-8
当我跑步时:
locale
我得到输出:
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
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE=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=
因此,LC_CTYPE 和 LC_ALL 设置似乎不正确。我该如何修复它们?我尝试过:
sudo update-locale LC_CTYPE=en_US.UTF-8
输出:
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 the standard locale ("C").
知道如何修复这个问题吗?
编辑:我也尝试过这个:
sudo dpkg-reconfigure locales
输出:
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 the standard locale ("C").
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
Generating locales...
en_AG.UTF-8... up-to-date
en_AU.UTF-8... up-to-date
en_BW.UTF-8... up-to-date
en_CA.UTF-8... up-to-date
en_DK.UTF-8... up-to-date
en_GB.UTF-8... up-to-date
en_HK.UTF-8... up-to-date
en_IE.UTF-8... up-to-date
en_IN.UTF-8... up-to-date
en_NG.UTF-8... up-to-date
en_NZ.UTF-8... up-to-date
en_PH.UTF-8... up-to-date
en_SG.UTF-8... up-to-date
en_US.UTF-8... up-to-date
en_ZA.UTF-8... up-to-date
en_ZM.UTF-8... up-to-date
en_ZW.UTF-8... up-to-date
Generation complete.
执行以下操作似乎可以使其起作用。但我如何才能使其永久生效?我做到了:
export LANGUAGE=en_US.UTF-8
答案1
以下内容在 Ubuntu 14.04 (VPS@Linode) 上对我有用:
编辑 /etc/environment 并添加以下行:
LC_ALL="en_US.UTF-8"
注意:注意确切的错误。确保(有问题的)语言已正确生成,并相应地设置:/etc/default/locale。
答案2
我尝试了这个并且它对我有用。
/etc/default/locale
我在以下行的末尾添加了:
LC_ALL="es_CL.UTF-8"
要复制错误,请尝试使用 perl:perl
在命令行中键入,然后应该会出现错误(要退出 perl,请按CTRL+C
)。然后更改文件,注销(exit
命令),然后再次登录;现在尝试键入perl
,错误应该消失。