close

[Solved] ImportError: No module named ‘encodings’

Hello Guys, How are you all? Hope You all Are Fine. Today I am just trying to run python command And I am facing following error ImportError: No module named ‘encodings’ in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ImportError: No module named ‘encodings’ Error Occurs ?

I am just trying to run python command And I am facing following error.

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

How To Solve ImportError: No module named ‘encodings’ Error ?

  1. How To Solve ImportError: No module named 'encodings' Error ?

    To Solve ImportError: No module named 'encodings' Error You Just need to remove virtual environment files. Follow this command Just run this command rm -rf venv and then virtualenv -p /usr/bin/python3 venv/ Then source venv/bin/activate and then pip install -r requirements.txt. Second solution is In My case I just updated my python to Python 3.7 and still my Environment variable Path is Old and Suggesting Python 3.5 Solution is simple. When you install python3.7, you can custom install and check Add Python to environment variables in Advanced Options.

  2. ImportError: No module named 'encodings'

    To Solve ImportError: No module named 'encodings' Error You Just need to remove virtual environment files. Follow this command Just run this command rm -rf venv and then virtualenv -p /usr/bin/python3 venv/ Then source venv/bin/activate and then pip install -r requirements.txt. Second solution is In My case I just updated my python to Python 3.7 and still my Environment variable Path is Old and Suggesting Python 3.5 Solution is simple. When you install python3.7, you can custom install and check Add Python to environment variables in Advanced Options.

Solution 1: remove virtual environment files

You Just need to remove virtual environment files. Follow this command.

rm -rf venv
virtualenv -p /usr/bin/python3 venv/
source venv/bin/activate
pip install -r requirements.txt

Now your error must be solved.

Solution 2: Update python PATH in Environment Variable

In My case I just updated my python to Python 3.7 and still my Environment variable Path is Old and Suggesting Python 3.5

Solution is simple. When you install python3.7, you can custom install and check Add Python to environment variables in Advanced Options.

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Please Rate Our Solution to Motivate Us For Give Our Best

Leave a Comment