AttributeError:模块'enum'在Pycharm中没有属性'IntFlag'

问题描述 投票:0回答:1

我已阅读并尝试了这里的每一条评论:Why Python 3.6.1 throws AttributeError: module 'enum' has no attribute 'IntFlag'?但仍然没有任何帮助。

我正在使用Pycharm Pycharm 2018.3社区版,我的Python版本是3.7

每次我尝试为Pycharm设置解释器时都会出现此错误:

Error in sitecustomize; 
set PYTHONVERBOSE for traceback: AttributeError: module 'enum' has no attribute 'IntFlag'
Traceback (most recent call last):   File "/Applications/PyCharm CE.app/Contents/helpers/packaging_tool.py", line 2, in <module>
import traceback   File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/traceback.py", line 5, in <module>
import linecache   File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/linecache.py", line 11, in <module>
import tokenize   File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tokenize.py", line 33, in <module>
import re   File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/re.py", line 143, in <module>
class RegexFlag(enum.IntFlag): AttributeError: module 'enum' has no attribute 'IntFlag'

希望得到帮助。

python pycharm
1个回答
3
投票

我在PyCharm中遇到了同样的问题,一个简单的程序没有运行。在PyCharm之外,我没有任何问题。比较python -v之后发生了什么

lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

a successful run used lib/python3.6/__pycache__/re.cpython-36.pyc' and then 
/lib/python3.6/__pycache__/enum.cpython-36.pyc'

while the failed run included: lib/python3.6/__pycache__/re.cpython-36.pyc'
and then: google_appengine/lib/grpcio-1.9.1/enum/__pycache__/__init__.cpython-36.pyc 

在PyCharm中禁用App Engine支持后,一切正常。

© www.soinside.com 2019 - 2024. All rights reserved.