So, recently, I saw that many beginners are encountering this difficulty while installing Python 3 for the first time; in fact, when I installed Python for the first time, I had the same issue. The solution is simple, as we shall see in this article.
So, when we install Python 3, we usually do skip and next without selecting any options. When we install Python, we get the “Add To Path” option; if we ignore this option, we get this error in Python.
The scenario differs depending on the type of operating system.
The resulting error for Windows looks like this:
The resulting error for Linux looks like this:
Possible things that could raise this error?
For Windows Users Steps are:
Then click OK to go to the CMD terminal and check for python. The error should now be resolved.
For Linux Users:
Setting path in linux is different it depends on the shell you are currently using. For different shells it will be like this:
a). In the csh shell −
type setenv PATH "$PATH:/usr/local/bin/python3" and press Enter.
b). In the bash shell (Linux) −
type export PYTHONPATH=/usr/local/bin/python3.x and press Enter.
c). In the sh or ksh shell −
type PATH = "$PATH:/usr/local/bin/python3" and press Enter.
Note − /usr/local/bin/python3 is the path of the Python directory.
For ImportError : No module named ‘encodings’ in a virtual environment:
The Error Should look like this:
You Just need to remove virtual environment files. Follow this command.
rm -rf venv virtualenv -p /usr/bin/python3 venv/ source venv/bin/active pip install -r requirements.txt
It is all about this issue. I hope this is found useful for you guys. Let me know if you have any queries regarding this, Thank You.