perl locale 警告

1
2
3
4
5
6
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "C"
are supported and installed on your system.
  1. 检查你的系统支持哪些locale。在终端中输入以下命令:

    1
    locale -a
  2. 如果你看到你想要的locale(比如 “en_US.UTF-8” 或 “zh_CN.UTF-8”),你可以通过修改你的bash配置文件(如 ~/.bashrc~/.bash_profile)来设置它。在文件的末尾添加以下行:

    1
    2
    export LC_ALL=en_US.UTF-8
    export LANG=en_US.UTF-8
  3. source 使设置生效。

  4. 如果在 locale -a 的输出中没有你想要的locale,你可能需要生成它。你可以使用 locale-gen 命令来生成新的locale。例如,如果你想生成 “en_US.UTF-8”,你可以运行:

1
sudo locale-gen en_US.UTF-8

然后,按照上述步骤设置你的 LC_ALLLANG 环境变量。