当我运行perl时,我得到警告:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

我该怎么解决呢?


当前回答

在我的情况下,使用Debian 8.6 (Jessie),我必须更改设置:

/etc/ssh/ssh_config` for `#AcceptEnv LANG LC_*

and

sshd_config为SendEnv LANG LC_*

然后重新启动ssh服务。

最后,我做到了:

locale-gen en_US。UTF-8和dpkg-reconfigure区域设置

其他回答

如果您正在使用反引导创建rootfs,则需要生成区域设置。你可以通过运行:

# (optional) enable missing locales
sudo nano /etc/locale.gen

# then regenerate
sudo locale-gen

这个技巧来自https://help.ubuntu.com/community/Xen

这通常意味着您还没有正确地在Linux机器上设置区域设置。

在Debian或Ubuntu上,这意味着你需要去做

$ sudo locale-gen
$ sudo dpkg-reconfigure locales

另参见man locale-gen。

我们将设置重启后不会取消设置的区域设置。

首先打开Bash文件并编辑它:

nano .bashrc

将这些行添加到文件中:

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

通过重新加载Bash激活更改:

source ~/.bashrc

测试结果:

locale

如果您使用Mac OS X v10.10 (Yosemite)或以上版本来连接服务器Linux,您可以尝试这些步骤。

保持/etc/ssh/sshd-config文件原始 输入~/.bash_profile 出口LANG = " en_US " 出口LC_ALL = $朗。utf - 8 运行 dpkg-reconfigure地区 并选择“en_US”。utf - 8”

前面的答案都是错的。消息是明确的-缺少区域设置。解决方案是添加适当的区域设置。您可以通过编辑/etc/locale.生成文件,删除被报告为缺失的地区前面的#符号,然后发出命令:

$ sudo locale-gen

这将实际生成在/etc/locale.中指定的地区Gen,因此消息将不会显示。