我在代码中添加了
import locale
locale.setlocale(locale.LC_NUMERIC, "de_DE")
plt.rcParams['axes.formatter.use_locale'] = True
import matplotlib.pyplot as plt
import numpy as np
它不起作用locale.Error: unsupported locale setting
我测试了我是否有de_DE
列在locale -a
中,而我没有:
cs_CZ.utf8
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
id_ID.utf8
POSIX
这里是否也有默认的逗号?我认为CZ,但不是,还有点。所以我试着安装deu de
cd /usr/share/locales
./install-language-pack de_DE
然而,结果是
sed: dočasný soubor /etc/sed8Oob4Q nelze otevřít: Operace zamítnuta
这意味着手术是成功的 拒绝。你知道吗
写作而不是locale.setlocale(locale.LC_ALL, 'de_DE')
locale.setlocale(locale.LC_ALL, 'de_DE.utf8')
也有帮助。你知道吗
我试着跑到终点站
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
sudo dpkg-reconfigure locales
我应该选择像deu de一样的默认语言,尽管我使用另一种语言吗?你知道吗
然后我用export LC_ALL=C
什么也没发生。你有没有别的主意用matplotlib逗号代替轴上的点?谢谢
如果在加载matplotlib之前调用
plt.rcParams
,则代码不正确。你知道吗此代码工作正常:
相关问题 更多 >
编程相关推荐