Invalid python sd, Fatal Python error: init_fs_encoding: failed to get the Python cod [How to Solve]

Error:
prompt when opening pycharm: invalid python sdk.
The cmd appears as: Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding;
Error message:
Python path configuration:
PYTHONHOME = ‘C:\PythonHome’
PYTHONPATH = ‘C:\PythonPath’
program name = ‘D:\Python38\python.exe’
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = ‘D:\Python38\python.exe’
sys.base_prefix = ‘C:\PythonHome’
sys.base_exec_prefix = ‘C:\PythonHome’
sys.executable = ‘D:\Python38\python.exe’
sys.prefix = ‘C:\PythonHome’
sys.exec_prefix = ‘C:\PythonHome’
sys.path = [
‘C:\PythonPath’,
‘D:\Python38\python38.zip’,
‘C:\PythonHome\DLLs’,
‘C:\PythonHome\lib’,
‘D:\Python38’,
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named ‘encodings’
Current thread 0x00008bd8 (most recent call first):

Configuring environment variables, no matter how they are configured, does not work.

Solution:
Tried opening the installation package directly and reinstalling it, and making changes in System Applications and Features, but none of them solved it.
I can only find python in settings-applications and features, uninstall it first, and then reinstall it.
The problem is solved, although after re-entering pycharm, the previous library needs to be reinstalled.

Read More: