我一直在努力让这个软件 Anki 工作,但它一直说:
Traceback (most recent call last):
File "/usr/bin/anki", line 5, in <module>
import aqt
File "/usr/share/anki/aqt/__init__.py", line 12, in <module>
from aqt.qt import *
File "/usr/share/anki/aqt/qt.py", line 10, in <module>
from anki.utils import isWin, isMac
File "/usr/share/anki/anki/__init__.py", line 14, in <module>
raise Exception("Anki requires a UTF-8 locale.")
Exception: Anki requires a UTF-8 locale.
我查看了这里的一些问题并尝试了所有方法(我认为),但无法以某种方式更改语言环境设置。
lsb_release-a:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.5 LTS
Release: 12.04
Codename: precise
我的locale
输出:
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
我的locale -a
输出:
C
C.UTF-8
POSIX
en_US
en_US.iso88591
en_US.utf8
/etc/default/locale 内部:
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
答案1
这可能是由于未设置 LANG 变量造成的。尝试运行:
LANG=en_US.UTF-8 anki