Fatal Python error: initfsencoding: unable to load the file system codec

When both Python 2 and Python 3 exist and one of them fails to start, an error is reported in one of two cases
1. File error in python2 path failed to start python3

Fatal Python error: initfsencoding: Unable to load the file system codec
file “C:\Python27\Lib\encodings\__init__. Py “, line 123
ise CodecRegistryError,\
^>r> syntaxe> : invalid syntax
Current thread 0x000004dc (most recent call first):
2, file error in python3 path failed to start

File “E:\Python37\Lib\site.py”, line 177
File =sys.stderr)

s>xerror: invalid syntax
The above two cases in returning the same, the reason is to set the environment variable PYTHONPATH, PYTHONPATH is Python search path, we import the default module will search from the PYTHONPATH, environment variable is set to one version of the module path, lead to another version of the module loading path error when starting, leading to launch failure, this is according to the online tutorial to install Python when leaving a hole, the variable can not actually, The environment variable needs to be configured when the custom module is no longer in the Python installation path, so you can remove this environment variable, or just remove C:\Pythonxx\Lib

Perfect solution after deletion

Read More: