Solvedhomebrew core "module 'enum' has no attribute 'IntFlag'" when installing python3

  • Ran brew update and retried your prior step?
  • Ran brew doctor, fixed as many issues as possible and retried your prior step?
  • Confirmed this is problem with specific formulae and not Homebrew/brew? If it's a general Homebrew/brew problem please file this issue at

I am running OS X 10.10.5 with Python 2 installed via Homebrew, chosen as the default. I'm trying to install Python 3 alongside it:

brew install python3

I get the following error:

==> /usr/local/Cellar/python3/3.6.0/bin/python3 -s --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.6.0/bin --in
Last 15 lines from /Users/werner/Library/Logs/Homebrew/python3/post_install.01.python3:

Failed to import the site module
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/", line 75, in <module>
  File "/usr/local/lib/python2.7/site-packages/", line 27, in __boot
    import imp # Avoid import loop in Python >= 3.3
  File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/", line 27, in <module>
    import tokenize
  File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/", line 33, in <module>
    import re
  File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/", line 142, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

My logs are here:

I am assuming this should work with which python pointing to Python installed via Homebrew?

My $PYTHONPATH is set to /usr/local/lib/python2.7/site-packages: — also not sure if this is expected behavior. I don't remember setting it anywhere and none of my shell config files have it.

Same problem is mentioned here without a solution.

21 Answers

✔️Accepted Answer

@deering59 Make sure that nowhere in your shell configuration files, PYTHONPATH is set to point to your Python 2.7 installation. You can check its current value with echo $PYTHONPATH – for me it's now empty.

Other Answers:

More Issues: