pip3安装报错AttributeError: module 'enum' has no attribute 'IntFlag'

问题综述

mac下使用pip3安装包的时候报错:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 544, in <module>
    main()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 530, in main
    known_paths = addusersitepackages(known_paths)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 282, in addusersitepackages
    user_site = getusersitepackages()
  File "/Library/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 "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site.py", line 248, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sysconfig.py", line 601, in get_config_var
    return get_config_vars().get(name)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sysconfig.py", line 580, in get_config_vars
    import _osx_support
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/_osx_support.py", line 4, in <module>
    import re
  File "/Library/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'

解决方案

在终端输入:

unset PYTHONPATH

猜你喜欢

转载自blog.csdn.net/ooffrankdura/article/details/80173206