您可能没有任何de_DE区域设置可用。
您可以使用locale -a命令查看可用语言环境的列表。
例如,在我的机器上:
$ locale -a
C
C.UTF-8
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZM
en_ZM.utf8
en_ZW.utf8
it_CH.utf8
it_IT.utf8
POSIX
请注意,如果要将语言环境设置为it_IT,还必须指定.utf8:
>>> import locale
>>> locale.setlocale(locale.LC_ALL, 'it_IT') # error!
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/locale.py", line 539, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
>>> locale.setlocale(locale.LC_ALL, 'it_IT.utf8')
'it_IT.utf8'
要安装新的区域设置,请使用:
sudo apt-get install language-pack-id
其中id是语言代码(取自here)
安装区域设置后,您应该遵循Julien Palard建议,并使用以下方式重新配置区域设置:
sudo dpkg-reconfigure locales