On a ubuntu 16.04 machine I experience since some time ago an error like this if I execute some python programs, for example pythontex
(same with 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
is the program I actually needed, but the same problem occurs with 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
I tried a dpkg-reconfigure python python3 python2.7
but it didn't help. How can I fix this issue?