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

我该怎么解决呢?


当前回答

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

其他回答

将以下内容添加到/etc/environment中,为我解决了Debian和Ubuntu上的问题(当然,修改以匹配您想使用的语言环境):

LANGUAGE=en_US.UTF-8
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: No such file or directory

解决方案:

试试这个(uk_UA。UTF-8是我当前的语言环境。编写语言环境,例如en_US。utf - 8 !)

sudo locale-gen uk_UA.UTF-8

这。

sudo dpkg-reconfigure locales

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

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

# then regenerate
sudo locale-gen

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

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

对于Debian用户,我在修改我的区域设置以更改机器的语言后遇到了这个问题。这就是我所做的:

修改. bashrc: 出口LANG = fr_FR。utf - 8 出口LC_ALL = fr_FR。utf - 8 取消注释行fr_FR。文件etc/locale中的UTF-8。Gen -> sudo locale-gen生成丢失的包 sudo update-locale sudo dpkg-reconfigure locale将我的locale配置为fr_FR。utf - 8 在etc/default/locale文件中添加额外的行: 语言= en_US。utf - 8 LC_ALL = en_US。utf - 8 LANG = en_US。utf - 8 LC_TYPE = en_US。utf - 8 重启我的电脑,一切正常