简体   繁体   中英

Running python code give NameError: name 'ABCMeta' is not defined every time

I'm using Python 3.7.3 with PyCharm. When I tried to import abc package into my project I got this error followed with Python quit unexpectedly alert dialog:

Fatal Python error: init_sys_streams: can't initialize sys standard streams
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/io.py", line 52, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/abc.py", line 166, in <module>
NameError: name 'ABCMeta' is not defined
Abort trap: 6

At first I didn't pay much attention to the error and thought I made a mistake in the code. So I commented import abc line. But the error didn't disappear. Moreover, each time I was running python3 programs I was getting the same error. Even in terminal:

终端python3错误

  • Previously I had Anaconda installed, but uninstalled it later.
  • In my project I'm using pipenv
  • I also have python 2 but I don't use it. I tried to run it and there was no such error.
  • Previously I tried to install vptyhon in many ways. I didn't know about pip then, so I could mess up the framework.

删除/Library/Frameworks/Python.framework文件并重新安装 python 3.7.3 解决了错误

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM