Bash
連接到 raspberry 時出現 bash ssh 警告:setlocale: LC_ALL: cannot change locale (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”或嘗試在樹莓中安裝新應用程序時,我遇到了與語言相關的錯誤。這就是為什麼我開始尋找解決方案…
一些附加資訊:
當我在覆盆子上輸入“語言環境”時,我收到以下消息:
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=
ssh 會將“一些”環境變數從 mirind4-pc 轉發到 raspberry,其中包括“locale”變數(用於列印友好的日期和數字)。
根據Raspian和Ask Unbuntu上的 misc 連結,您可能需要生成本地語言環境。據我猜測
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 上有效