I'm using homebrew as my package manager. While installing python3 with brew install python3 I am getting the following error

class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

I've tried the steps outlined in homebrew Troubleshooting but the problem still exists. Any pointers would be helpful.


1 Answer 1


Once you have determined that it's not a homebrew problem using their troubleshooting guide my first suspicion would be that you are picking up the wrong version of the enum module. Make sure you are not setting PYTHONPATH anywhere (echo $PYTHONPATH at the command line will tell you) and try again.

The other possibility I would check is that you are running the right version of Python. which python should return /usr/bin/python (the version Apple installs), if not then you might want to check your PATH shell variable and temporarily set it to something else.

  • should the PYTHONPATH point to python 3.x or 2.x ? I read it's recommended to say cmd 'python3' with python 3.x and cmd 'python' with python 2.x Jan 12, 2017 at 16:40
  • I can't make a recommendation on this because I use the Anaconda install of Python, not the home-brew one. I have PYTHONPATH pointing only to PyObjC so that it is picked up but nothing else from the Apple install of Python. ` export PYTHONPATH="$PYTHONPATH:/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC" ` Jan 15, 2017 at 21:26
  • Why should which python point to the system Python? What if it points to a version installed via Homebrew? What is the correct way to install Python 3.x alongside the 2.x Homebrew version in this case?
    – slhck
    Jan 23, 2017 at 13:56
  • The person asking the question had installed python3 with homebrew. Therefore, for the sake of the system, python should be python 2, the system one. If you're installing python 2 and 3 with homebrew then which python should point to the homebrew python 2 and python3 should point to python 3. Jan 24, 2017 at 3:02
  • Hmm, but even when I have Homebrew Python 2, and python pointing to it, I get this error. (Btw you forgot the @slhck, just came here again by accident.)
    – slhck
    Jan 24, 2017 at 12:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .