VS2019使用Keras.Net报错:Fatal Python error: initfsencoding: unable to load the file system codec. ModuleNotFoundError: No module named ‘encodings’
-
情景:
使用Keras.Net的Load_Model方法加载模型时,报错:【Fatal Python error: initfsencoding: unable to load the file system codec. ModuleNotFoundError: No module named ‘encodings’】
-
环境:
- Visual Studio 2019 Version 16.6.5
- Keras.Net
- Anacanda(Python 3.7.6)
- Asp.Net Core Console
-
方案:
-
右键【我的电脑】,点击【属性】,然后选择左侧的【高级系统设置】;
-
点击【环境变量】,打开系统环境变量配置;
-
选择系统环境变量中的【Path】,点击【编辑】,查看是否配置了Python的环境变量,如若没有,请配置;因为我使用的是Anaconda,所以配置的路径也就是Anaconda的路径;
-
配置完成后,还需要在用户变量中添加
PYTHONHOME
和PYTHONPATH
两个变量; -
接下来,最重要的一步,就是重启Visual Studio 2019,否则依旧会报错。
-