pypipython-3.x95% confidence\u2191 170

ImportError: No module named 'encodings'

Full error message
I recently reinstalled ubuntu and did upgrade to 16.04 and cannot use python:

$ python manage.py runserver
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Aborted

At this point, python itself doesn't work

$ python
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Aborted

Even this suggestion is no longer working:

unset PYTHONHOME
unset PYTHONPATH

Every every I fix it one way, it comes back again. Several answers help to fix it temporarily, but not for good. I have reinstalled python and python3 several times. What can I do from here?

For Python-3 try removing virtual environment files. And resetting it up. rm -rf venv virtualenv -p /usr/bin/python3 venv/ source venv/bin/activate pip install -r requirements.txt https://wiki.ubuntu.com/XenialXerus/ReleaseNotes#Python_3 edit fo

API access

Get this solution programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/error/cf7e07f7c71b81be39a34710ca4731119e05d035944bf1d344da0e91b63ce93c
hash \u00b7 cf7e07f7c71b81be39a34710ca4731119e05d035944bf1d344da0e91b63ce93c
ImportError: No module named &#39;encodings&#39; — DepScope fix | DepScope