当我尝试从命令提示符访问python时,Windows 10上的致命python错误
我在上一个线程中做了 这些答案中的所有内容 并没有任何改变。即使卸载Python也没有改善这种情况。一切都工作正常,但突然就停止工作了。
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = 'python'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = 'C:\\iverilog\\gtkwave\\bin\\python.exe'
sys.base_prefix = 'D:\\a\\_temp\\msys\\msys64\\mingw64'
sys.base_exec_prefix = 'D:\\a\\_temp\\msys\\msys64\\mingw64'
sys.executable = 'C:\\iverilog\\gtkwave\\bin\\python.exe'
sys.prefix = 'D:\\a\\_temp\\msys\\msys64\\mingw64'
sys.exec_prefix = 'D:\\a\\_temp\\msys\\msys64\\mingw64'
sys.path = [
'D:\\a\\_temp\\msys\\msys64\\mingw64\\lib\\python38.zip',
'D:\\a\\_temp\\msys\\msys64\\mingw64\\lib\\python3.8',
'D:\\a\\_temp\\msys\\msys64\\mingw64\\lib\\python3.8',
'D:\\a\\_temp\\msys\\msys64\\mingw64\\lib\\lib-dynload',
]
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 0x000029e8 (most recent call first):
<no Python frame>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我只是遇到了同样的问题。
回顾过去,错误很明显:
modulenotfoundError:没有名为“编码”的模块
意味着Python无法找到编码模块,这是Python内置模块之一。我查看了我的文件系统,发现编码模块是在c:\ msys64 \ mingw64 \ lib \ lib \ python3.8 \ condodings
上找到的。这意味着Python找不到该文件夹!我的简单解决方案是将
c:\ msys64 \ mingw64 \ lib \ python3.8
添加到pythonpath
环境变量。在Windows上,您可以从设置Pythonpath = C:\ MSYS64 \ Mingw64 \ lib \ python3.8 \ 。这种感觉就像是一个黑客,因为作为基本的Python模块,它应该自动找到,但却没有。但是,在这一点上,我没有其他与Python有关的问题,所以我认为这确实可以解决问题。
I've just had the same problem.
Looking back, the error is fairly clear:
ModuleNotFoundError: No module named 'encodings'
means Python is not able to find the encodings module, one of Python built-in modules. I had a look at my filesystem and found out that the encodings module is found atC:\msys64\mingw64\lib\python3.8\encodings
. This meant that Python could not find that folder!My simple solution was to add
C:\msys64\mingw64\lib\python3.8
to thePYTHONPATH
environment variable. On Windows you can either set it from the Windows settings UI - the permanent way - or set it temporarily from the command line, using this command:set PYTHONPATH=C:\msys64\mingw64\lib\python3.8\
.This kind of feels like a hack since, as a basic Python module, it should be found automatically and yet doesn't. However, at this point, I've had no other Python-related problems so I figure it really does the trick.