manpath:无法设置区域设置;确保 $LC_* 和 $LANG 正确

Ale*_*ler 8 locale

当我ssh进入运行 Ubuntu 18.04 的 EC2 实例时,出现以下错误:

manpath: can't set the locale; make sure $LC_* and $LANG are correct
Run Code Online (Sandbox Code Playgroud)

我尝试了这个,但这并没有解决它:

sudo locale-gen "en_US.UTF-8"
sudo dpkg-reconfigure locales
Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_TERMINAL_VERSION = "3.3.7",
    LC_CTYPE = "UTF-8",
    LC_TERMINAL = "iTerm2",
    LANG = "C.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("C.UTF-8").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory
Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LC_TERMINAL_VERSION = "3.3.7",
    LC_TERMINAL = "iTerm2",
    LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LC_TERMINAL_VERSION = "3.3.7",
    LC_TERMINAL = "iTerm2",
    LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Run Code Online (Sandbox Code Playgroud)

小智 6

另一种选择是禁用发送 LC_* 环境变量。请参阅/sf/ask/2072656001/,这些步骤适用于 MacOS ssh 客户端:

sudo vi /etc/ssh/ssh_config
Run Code Online (Sandbox Code Playgroud)

找到这些设置:

Host *
      SendEnv LANG LC_*
Run Code Online (Sandbox Code Playgroud)

将其更改为:

Host *
#      SendEnv LANG LC_*
Run Code Online (Sandbox Code Playgroud)

保存文件,然后再次尝试连接。


Ale*_*ler 4

感谢Gunnar Hjalmarsson,我能够使用此解决方法:

unset LC_CTYPE~/.profile