Python locale error: unsupported locale setting
Python locale error: unsupported locale setting
Run following commands
export LC_ALL=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
sudo dpkg-reconfigure locales
It will solve this.
Make sure to match the .UTF-8
part to the actual syntax found in the output of locale -a
e.g. .utf8
on some systems.
According to this link, it solved by entering this command:
export LC_ALL=C
Python locale error: unsupported locale setting
You probably do not have any de_DE
locale available.
You can view a list of available locales with the locale -a
command.
For example, on my machine:
$ 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
Note that if you want to set the locale to it_IT
you must also specify the .utf8
:
>>> import locale
>>> locale.setlocale(locale.LC_ALL, it_IT) # error!
Traceback (most recent call last):
File <stdin>, line 1, in <module>
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
To install a new locale use:
sudo apt-get install language-pack-id
where id
is the language code (taken from here)
After you have installed the locale you should follow Julien Palard advice and reconfigure the locales with:
sudo dpkg-reconfigure locales