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

我该怎么解决呢?


当前回答

对我来说,我通过编辑.bashrc文件,添加导出来修复这个错误。添加在最初的注释之后。

添加语言支持。

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

其他回答

另一个与git相关的答案:

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

您需要在/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

对于Ubuntu Server和Debian:

不需要在bashrc中创建导出或处理dpkg-reconfigure。

只需将/etc/default/locale的内容替换为:

LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8

添加LC_ALL = " en_GB。Utf8”到/etc/environment并重新启动。这是所有。

如果不关心语言环境问题,可以设置PERL_BADLANG=0。当然,这可能导致不正确的本地化。