Python PyCharm:Py_Initialize:无法初始化系统标准流
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26569828/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PyCharm: Py_Initialize: can't initialize sys standard streams
提问by
I'm trying to use PyCharm IDE but none of my programs compile even simple Hello World. PyCharm gives this error:
我正在尝试使用 PyCharm IDE,但我的程序甚至都无法编译简单的 Hello World。PyCharm 给出了这个错误:
Fatal Python error: Py_Initialize: can't initialize sys standard streams
Traceback (most recent call last):
File "C:\Python34\lib\io.py", line 72, in <module>
AttributeError: 'module' object has no attribute 'ABCMeta'
Process finished with exit code 3
I'm not able to find the solution for it and also referred the link PyDev: Fatal error Python32\lib\io.py, line 60, in <module>but there is no solution there.
我无法找到它的解决方案,还引用了链接PyDev: Fatal error Python32\lib\io.py, line 60, in <module>但那里没有解决方案。
Python 3.4 is installed on my Win 7 OS system.
Python 3.4 安装在我的 Win 7 OS 系统上。
回答by u5018343
try this: File->Setting->Editor->File Encodings change the Project encoding to UTF-8
试试这个:文件->设置->编辑器->文件编码将项目编码更改为UTF-8
回答by Elizaveta Shashkova
Yes, as you said in the comment, the problem is in the filename 'abc'. You will be able to run this file within PyCharm, if you uncheck:
是的,正如您在评论中所说,问题出在文件名“abc”上。如果取消选中,您将能够在 PyCharm 中运行此文件:
- Add content roots to PYTHONPATH
- Add sources roots to PYTHONPATH
- 将内容根添加到 PYTHONPATH
- 将源根添加到 PYTHONPATH
in the menu "Run/Debug Configurations".
在菜单“运行/调试配置”中。
回答by janeluck
I have the same problem, just change your file's name from io.py to something else, It's work!
我有同样的问题,只需将您的文件名从 io.py 更改为其他名称,就可以了!
回答by Deqing
Finally found how to solve this problem in PyCharm: never use a name like abc.pyor test.py.
终于在 PyCharm 中找到了解决这个问题的方法:永远不要使用像abc.py或这样的名字test.py。
Simply use another name, like a.pyor my-unique-file-name.py
只需使用另一个名称,例如a.py或my-unique-file-name.py
回答by vinay
I faced the same problem because I created a file named abc.py, remove that file in your project, your error will disappear.
我遇到了同样的问题,因为我创建了一个名为 的abc.py文件,在您的项目中删除该文件,您的错误将消失。

