• <i id='xbhsB'><tr id='xbhsB'><dt id='xbhsB'><q id='xbhsB'><span id='xbhsB'><b id='xbhsB'><form id='xbhsB'><ins id='xbhsB'></ins><ul id='xbhsB'></ul><sub id='xbhsB'></sub></form><legend id='xbhsB'></legend><bdo id='xbhsB'><pre id='xbhsB'><center id='xbhsB'></center></pre></bdo></b><th id='xbhsB'></th></span></q></dt></tr></i><div id='xbhsB'><tfoot id='xbhsB'></tfoot><dl id='xbhsB'><fieldset id='xbhsB'></fieldset></dl></div>
      <bdo id='xbhsB'></bdo><ul id='xbhsB'></ul>

    <small id='xbhsB'></small><noframes id='xbhsB'>

    <legend id='xbhsB'><style id='xbhsB'><dir id='xbhsB'><q id='xbhsB'></q></dir></style></legend>
      1. <tfoot id='xbhsB'></tfoot>
      2. 为什么 Python 3.6.1 抛出 AttributeError:模块 'enum' 没有属性 &#

        Why Python 3.6.1 throws AttributeError: module #39;enum#39; has no attribute #39;IntFlag#39;?(为什么 Python 3.6.1 抛出 AttributeError:模块 enum 没有属性 IntFlag?)
        • <tfoot id='WEZyK'></tfoot>

          <small id='WEZyK'></small><noframes id='WEZyK'>

          <i id='WEZyK'><tr id='WEZyK'><dt id='WEZyK'><q id='WEZyK'><span id='WEZyK'><b id='WEZyK'><form id='WEZyK'><ins id='WEZyK'></ins><ul id='WEZyK'></ul><sub id='WEZyK'></sub></form><legend id='WEZyK'></legend><bdo id='WEZyK'><pre id='WEZyK'><center id='WEZyK'></center></pre></bdo></b><th id='WEZyK'></th></span></q></dt></tr></i><div id='WEZyK'><tfoot id='WEZyK'></tfoot><dl id='WEZyK'><fieldset id='WEZyK'></fieldset></dl></div>
          <legend id='WEZyK'><style id='WEZyK'><dir id='WEZyK'><q id='WEZyK'></q></dir></style></legend>
            <bdo id='WEZyK'></bdo><ul id='WEZyK'></ul>
                <tbody id='WEZyK'></tbody>

                  本文介绍了为什么 Python 3.6.1 抛出 AttributeError:模块 'enum' 没有属性 'IntFlag'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I just installed Python 3.6.1 for MacOS X

                  When I attempt to run the Console(or run anything with Python3), this error is thrown:

                    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'  
                  

                  The class IntFlag exists within enum.py. So, why is the AttributeError being thrown?

                  解决方案

                  It's because your enum is not the standard library enum module. You probably have the package enum34 installed.

                  One way check if this is the case is to inspect the property enum.__file__

                  import enum
                  print(enum.__file__)  
                  # standard library location should be something like 
                  # /usr/local/lib/python3.6/enum.py
                  

                  Since python 3.6 the enum34 library is no longer compatible with the standard library. The library is also unnecessary, so you can simply uninstall it.

                  pip uninstall -y enum34
                  

                  If you need the code to run on python versions both <=3.4 and >3.4, you can try having enum-compat as a requirement. It only installs enum34 for older versions of python without the standard library enum.

                  这篇关于为什么 Python 3.6.1 抛出 AttributeError:模块 'enum' 没有属性 'IntFlag'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Split a Pandas column of lists into multiple columns(将 Pandas 的列表列拆分为多列)
                  How does the @property decorator work in Python?(@property 装饰器在 Python 中是如何工作的?)
                  What is the difference between old style and new style classes in Python?(Python中的旧样式类和新样式类有什么区别?)
                  How to break out of multiple loops?(如何打破多个循环?)
                  How to put the legend out of the plot(如何将传说从情节中剔除)
                  Why is the output of my function printing out quot;Nonequot;?(为什么我的函数输出打印出“无?)
                1. <tfoot id='aWdFU'></tfoot>
                2. <i id='aWdFU'><tr id='aWdFU'><dt id='aWdFU'><q id='aWdFU'><span id='aWdFU'><b id='aWdFU'><form id='aWdFU'><ins id='aWdFU'></ins><ul id='aWdFU'></ul><sub id='aWdFU'></sub></form><legend id='aWdFU'></legend><bdo id='aWdFU'><pre id='aWdFU'><center id='aWdFU'></center></pre></bdo></b><th id='aWdFU'></th></span></q></dt></tr></i><div id='aWdFU'><tfoot id='aWdFU'></tfoot><dl id='aWdFU'><fieldset id='aWdFU'></fieldset></dl></div>

                        1. <legend id='aWdFU'><style id='aWdFU'><dir id='aWdFU'><q id='aWdFU'></q></dir></style></legend>
                            <tbody id='aWdFU'></tbody>

                          <small id='aWdFU'></small><noframes id='aWdFU'>

                            <bdo id='aWdFU'></bdo><ul id='aWdFU'></ul>