简体   繁体   English

如何使用 Python 更改 Windows 默认语言环境?

[英]How to change Windows default locale using Python?

I searched and get this https://docs.python.org/2/library/locale.html , but can't find a way to change default locale.我搜索并获得了这个https://docs.python.org/2/library/locale.html ,但找不到更改默认语言环境的方法。

Some program need to run under a certain locale.某些程序需要在特定语言环境下运行。 I'm using Locale Emulator now and wonder if there's a better way.我现在正在使用Locale Emulator ,想知道是否有更好的方法。

Did you try for eg你有没有尝试过例如

import locale

locale.setlocale(locale.LC_ALL, 'de_DE')

to change to German locale (substitute 'de_DE' for your required locale)?更改为德语语言环境(将“de_DE”替换为您所需的语言环境)?

In terms of setting the default locale, that would be done by your OS, not Python.在设置默认语言环境方面,这将由您的操作系统完成,而不是 Python。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM