当我运行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").

我该怎么解决呢?


当前回答

您需要在/etc/default/locale中适当地配置语言环境、注销、登录,然后运行常规命令

root@host:~# echo -e 'LANG=en_US.UTF-8\nLC_ALL=en_US.UTF-8' > /etc/default/locale
root@host:~# exit
local-user@local:~$ ssh root@host
root@host:~# locale-gen en_US.UTF-8
root@host:~# dpkg-reconfigure locales

其他回答

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

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

$ sudo locale-gen
$ sudo dpkg-reconfigure locales

另参见man locale-gen。

perl -e exit
sudo localedef -i en_US -f UTF-8 en_DE.UTF-8
#                                   DE = German
# Use your country code en lieu of  DE

# The second "perl" should then not complain any more
perl -e exit

localectl list-locales # Just make sure it is OK

您需要在/etc/default/locale中适当地配置语言环境、注销、登录,然后运行常规命令

root@host:~# echo -e 'LANG=en_US.UTF-8\nLC_ALL=en_US.UTF-8' > /etc/default/locale
root@host:~# exit
local-user@local:~$ ssh root@host
root@host:~# locale-gen en_US.UTF-8
root@host:~# dpkg-reconfigure locales

一如既往,细节决定成败。

在Mac OS X v10.7.5 (Lion)上,要修复一些Django错误,请在我的~/。bash_profile我已经设置:

export LANG=en_EN.UTF-8
export LC_COLLATE=$LANG
export LC_CTYPE=$LANG
export LC_MESSAGES=$LANG
export LC_MONETARY=$LANG
export LC_NUMERIC=$LANG
export LC_TIME=$LANG
export LC_ALL=$LANG

在很长一段时间里,我在使用Perl时都得到了这样的警告。

我的坏!我后来才意识到,我的系统是en_US.UTF-8! 我只是通过改变

export LANG=en_EN.UTF-8

to

export LANG=en_US.UTF-8

另一个与git相关的答案:

问题的根源可能是Git服务器。如果所有这些都失败了,请尝试在服务器上执行dpkg-reconfigure区域设置(或适合您的发行版的任何设置)。