目录

invalid-python-sd,Fatal-Python-error-init_fs_encoding-failed-to-get-the-Python-cod如何解决

invalid python sd,Fatal Python error: init_fs_encoding: failed to get the Python cod如何解决

症状:

打开pycharm时提示:invalid python sdk;

cmd中出现:Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding;

完整信息如下:

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):

配置环境变量不论怎么配置都不成功;

解决方式:

尝试了直接打开安装包重新安装、在系统应用和功能中进行修改,都解决不了。

只能在设置-应用和功能中,找到python,先卸载,再重新安装。

虽然重新进入pycharm后,之前的库需要重新install。但问题解决了。