在一台 ubuntu 16.04 机器上,如果我执行一些 python 程序,我不久前就会遇到这样的错误,例如pythontex
(与 相同pythontex --interpreter python:python3
)
Traceback (most recent call last):
File "/usr/local/bin/pythontex", line 50, in <module>
import pythontex2 as pythontex
File "/usr/local/texlive/2018/texmf-dist/scripts/pythontex/pythontex2.py", line 53, in <module>
import argparse
File "/usr/lib/python2.7/argparse.py", line 92, in <module>
from gettext import gettext as _
File "/usr/lib/python2.7/gettext.py", line 49, in <module>
import locale, copy, os, re, struct, sys
File "/usr/lib/python2.7/locale.py", line 13, in <module>
import encodings
ImportError: No module named encodings
pythontex
是我真正需要的程序,但同样的问题也发生在pip
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 4, in <module>
import locale
File "/usr/lib/python2.7/locale.py", line 13, in <module>
import encodings
ImportError: No module named encodings
我尝试了dpkg-reconfigure python python3 python2.7
,但没有帮助。我该如何解决这个问题?