热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

AttributeError:模块“枚举”在Pycharm中没有属性“IntFlag”

如何解决《AttributeError:模块“枚举”在Pycharm中没有属性“IntFlag”》经验,为你挑选了1个好方法。

我在这里阅读并尝试了所有评论:为什么Python 3.6.1抛出AttributeError:模块'enum'没有属性'IntFlag'?但仍然没有帮助。

我正在使用Pycharm Pycharm 2018.3 Community Edition,而我的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 
import traceback   File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/traceback.py", line 5, in 
import linecache   File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/linecache.py", line 11, in 
import tokenize   File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tokenize.py", line 33, in 
import re   File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/re.py", line 143, in 
class RegexFlag(enum.IntFlag): AttributeError: module 'enum' has no attribute 'IntFlag'

希望得到帮助。



1> 小智..:

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

lib/python3.6/re.py", line 142, in 
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支持后,一切运行正常。


推荐阅读
author-avatar
旺仔牛奶糖2702938317
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有