相关疑难解决方法(0)

Python语言环境错误:不支持的语言环境设置

为什么在python中执行此操作时会出现以下错误:

>>> import locale
>>> print str( locale.getlocale() )
(None, None)
>>> locale.setlocale(locale.LC_ALL, 'de_DE')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/locale.py", line 531, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
Run Code Online (Sandbox Code Playgroud)

这适用于其他语言环境,如fr或nl.我正在使用Ubuntu 11.04.

更新:执行以下操作不会产生任何结果:

dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = (unset)
    are supported and installed on your system.
perl: warning: Falling back to …
Run Code Online (Sandbox Code Playgroud)

python locale ubuntu-11.04

304
推荐指数
8
解决办法
32万
查看次数

标签 统计

locale ×1

python ×1

ubuntu-11.04 ×1