为了账号安全,请及时绑定邮箱和手机立即绑定

为什么Python 3.6.1抛出AttributeError:模块'enum'没有属性

为什么Python 3.6.1抛出AttributeError:模块'enum'没有属性

繁星coding 2019-11-18 10:50:48
我刚刚为MacOS X安装了Python 3.6.1当我尝试运行控制台(或使用Python3运行任何命令)时,抛出此错误:  AttributeError: module 'enum' has no attribute 'IntFlag'$ /Library/Frameworks/Python.framework/Versions/3.6/bin/python3  Failed to import the site module  Traceback (most recent call last):    File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 544, in <module>      main()    File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 530, in main      known_paths = addusersitepackages(known_paths)    File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 282, in addusersitepackages      user_site = getusersitepackages()    File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 258, in getusersitepackages      user_base = getuserbase() # this will also set USER_BASE    File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 248, in getuserbase      USER_BASE = get_config_var('userbase')    File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sysconfig.py", line 601, in get_config_var      return get_config_vars().get(name)    File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sysconfig.py", line 580, in get_config_vars      import _osx_support    File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/_osx_support.py", line 4, in <module>      import re    File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/re.py", line 142, in <module>      class RegexFlag(enum.IntFlag):  AttributeError: module 'enum' has no attribute 'IntFlag'  IntFlag类存在于enum.py中。那么,为什么会引发AttributeError?
查看完整描述

3 回答

?
扬帆大鱼

TA贡献1799条经验 获得超9个赞

对我来说,此错误是在安装gcloud组件app-engine-python以便集成到pycharm后发生的。即使pycharm现在不上传到app-engine,卸载模块也有帮助。


查看完整回答
反对 回复 2019-11-18
  • 3 回答
  • 0 关注
  • 639 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信