close

[Solved] Why Python 3.6.1 throws AttributeError: module ‘enum’ has no attribute ‘IntFlag’?

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Why Python 3.6.1 throws AttributeError: module ‘enum’ has no attribute ‘IntFlag’? in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Why Python 3.6.1 throws AttributeError: module ‘enum’ has no attribute ‘IntFlag’ Error Occurs?

Today I get the following error Why Python 3.6.1 throws AttributeError: module ‘enum’ has no attribute ‘IntFlag’? in python.

How To Solve Why Python 3.6.1 throws AttributeError: module ‘enum’ has no attribute ‘IntFlag’ Error ?

  1. How To Solve Why Python 3.6.1 throws AttributeError: module 'enum' has no attribute 'IntFlag' Error ?

    To Solve Why Python 3.6.1 throws AttributeError: module 'enum' has no attribute 'IntFlag' Error It's because your enum is not the standard library enum module. You probably have the package enum34 installed.

  2. Why Python 3.6.1 throws AttributeError: module 'enum' has no attribute 'IntFlag'?

    To Solve Why Python 3.6.1 throws AttributeError: module 'enum' has no attribute 'IntFlag' Error It's because your enum is not the standard library enum module. You probably have the package enum34 installed.

Solution 1

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.

Solution 2

Not sure whether you still have this issue. I had a similar issue and I was able to resolve it simply by unsetting PYTHONPATH

$ unset PYTHONPATH

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read