python – ImportError: No module named encodings

python – ImportError: No module named encodings

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

For Windows10 User.

I was using python3.4 on Windows10. I installed python3.5. I couldnt find PYTHONPATH, PYTHONHOME env variable. If I command python in CMD console, It kept using python3.4. I deleted python3.4. Whenever I command python in CMD console, it starts showing an error like below.

Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named encodings

I searched to figure out my problem. Solution was simple. When you install python3.5, you can custom install and check Add Python to environment variables in Advanced Options.

I just leave here for case that someone have similar issues visit here so that they dont waste their precious time much to figure out.

python – ImportError: No module named encodings

I was facing the same problem under Windows7. The error message looks like that:

Fatal Python error: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named encodings

Current thread 0x000011f4 (most recent call first):

I have installed python 2.7(uninstalled now), and I checked Add Python to environment variables in Advanced Options while installing python 3.6. It comes out that the Environment Variable PYTHONHOME and PYTHONPATH is still python2.7.

Finally I solved it by modify PYTHONHOME to python3.6 install path and remove variable PYTHONPATH.

Leave a Reply

Your email address will not be published.