skip to Main Content

So I’m running debian 10, and using python 3.7 (which I built from source). For some reason I can no longer use the CLI interpreter, and whenever I try to execute anything that relies on Python, it returns the following error:

Fatal Python error: initfsencoding: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f41b0784740 (most recent call first):
Aborted

However, when I run the exact same command (either for the interpreter or when running a different python application) using sudo, it works perfectly fine. It feels like the supporting python 3.7 modules are not accessible by the current user. But I’m not sure how to proceed in order to fix it.

2

Answers


  1. Chosen as BEST ANSWER

    Okay, so I found a way around this. I updated my python alias to point to python3.7 instead of python3. I am still, however, not sure if this is a solution, or a workaround. But it works now.


  2. You need to setup locale

    For standard UTF-8 en_US you can do:

    echo 'LC_ALL="en_US.UTF-8"' >> /etc/environment
    echo 'export LANGUAGE="en_US.UTF-8"' >> /etc/environment
    echo 'export LC_CTYPE="en_US.UTF-8"' >> /etc/environment
    echo 'export LANG="en_US.UTF-8"' >> /etc/environment
    source /etc/environment
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search