连接到树莓派时 bash ssh 警告:setlocale:LC_ALL:无法更改区域设置(en_US.UTF-8)

连接到树莓派时 bash ssh 警告:setlocale:LC_ALL:无法更改区域设置(en_US.UTF-8)

我尝试过例如解决我的问题并且也。

我的问题是,当我尝试连接到 Raspberry pi2 时,我收到以下消息:

Linux raspberrypi 3.18.7-v7+ #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Mar 21 13:25:48 2015 from 192.168.10.1
-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

不用说,当我尝试执行“apt-get upgrade”或尝试在我的树莓派中安装新应用程序时,我遇到了与语言相关的错误。这就是我开始寻找解决方案的原因……

一些附加信息:

当我在树莓派上输入“locale”时,我收到以下消息:

pi@raspberrypi ~ $ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

如果我在我的笔记本电脑上编写相同的命令(我想使用此笔记本电脑连接到树莓派ssh):

mirind4@mirind4-pc:~$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=

答案1

ssh 会将“一些”环境变量从 mirind4-pc 转发到 raspberry,其中包括“locale”变量(用于打印友好的日期和数字)。

根据其他链接拉斯皮安询问温本图您可能需要生成本地语言环境。据我猜测

sudo locale-gen de_DE.UTF-8
sudo dpkg-reconfigure locales

使用后可以立即查看

foo:~$ LC_TIME=de_DE.UTF-8 date +%A%B
SamstagMärz

我没有 raspian,但这在我的 ubuntu 上有效

相关内容