首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Python区域设置错误:不支持的区域设置

Python区域设置错误:不支持的区域设置
EN

Stack Overflow用户
提问于 2013-01-27 21:04:12
回答 21查看 423.2K关注 0票数 365

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

代码语言:javascript
复制
>>> import locale
>>> print str( locale.getlocale() )
(None, None)
>>> locale.setlocale(locale.LC_ALL, 'de_DE')
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.7/locale.py", line 531, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

这也适用于fr或nl等其他语言环境。我使用的是Ubuntu 11.04。

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

代码语言:javascript
复制
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 the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14547631

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档