Windows解决多版本python执行pip3时出错AttributeError: module 'enum' has no attribute 'IntFlag'?

摘要

本机装有python2.7和python3.6,执行pip和pip2时没有问题,执行pip3时提示:

C:Users>pip3
Traceback (most recent call last):
  File "e:python36lib
unpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "e:python36lib
unpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:Python36Scriptspip3.exe\__main__.py", line 2, in <module>
  File "e:python36lib
e.py", line 142, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

原因:

英文:This is likely caused by the package enum34. Since python 3.4 there's a standard library enum module, so you should uninstall enum34, which is no longer compatible with the enum in the standard library since enum.IntFlag was added in python 3.6.

中文:这可能是由enum34包引起的。因为python 3.4中有一个标准库枚举模块,所以您应该卸载enum34,它不再与标准库中的枚举兼容,因为枚举。IntFlag是在python 3.6中添加的。

解决办法:

pip uninstall enum34  

#卸载enum34

卸载后执行pip3,成功,昨天整了大半天终于解决了

C:Users>pip3

Usage:
  pip3 <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  config                      Manage local and global configuration.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  help                        Show help for commands.
原文地址:https://www.cnblogs.com/gcgc/p/10062727.html