问题描述
Fatal Python error: init_sys_streams: can't initialize sys standard Microsoft Windows [Version 10.0.17134.228]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>c:
C:\WINDOWS\system32>cd Python37-32
The system cannot find the path specified.
C:\WINDOWS\system32>cd \
C:\>cd Python37-32
C:\Python37-32>python
Fatal Python error: init_sys_streams: can't initialize sys standard streams
AttributeError: module 'io' has no attribute 'OpenWrapper'
Current thread 0x0000139c (most recent call first):
参考网址
解决方法
首先尝试在命令行执行python -E
,看是否不报错,如果加-E
不报错的话,直接执行python
报错的话,就用下面的方法解决。
-
在系统的环境变量里:(我的电脑-属性-高级设置-环境变量)里面存在
PYTHONHOME
和PYTHONPATH
,两个环境变量,删除这两个就可以了。 -
如果因为使用
snippets
所以得用PYTHONHOME
的话,那么就在现有的环境变量PATH
里找肯定有跟PYTHONHOME
重复的环境变量,删除就好了。