无法在 Python3.6 上安装枚举包

Cannot install enum package on Python3.6

我正在尝试 运行 this example 在 MacOS High Sierra 上。需要安装page包,需要安装pytodos包,需要安装enum包,安装失败。

$ python3 page_object_test_case.py 
Traceback (most recent call last):
  File "page_object_test_case.py", line 3, in <module>
    import page
ModuleNotFoundError: No module named 'page'
$ pip3 install page
...
Successfully installed click-6.7 page-1.0.16
$ python3 page_object_test_case.py 
Traceback (most recent call last):
  File "page_object_test_case.py", line 3, in <module>
    import page
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/page/__init__.py", line 2, in <module>
    from pytodos import todo
ModuleNotFoundError: No module named 'pytodos'
$ pip3 install pytodos
Collecting pytodos
...
Collecting enum==0.4.6 (from pytodos)
  Downloading https://files.pythonhosted.org/packages/0c/4e/1ea357e7783c756bb579333c1e4a026fb331371ee771f616ffedc781e531/enum-0.4.6.tar.gz
    Complete output from command python setup.py egg_info:
    /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/version.py:1: UserWarning: Module enum was already imported from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/enum.py, but /private/var/folders/h3/1znktv0s36j1fdqcdrr0zvcw0000gn/T/pip-install-jhfn7vc3/enum is being added to sys.path
      import pkg_resources
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/h3/1znktv0s36j1fdqcdrr0zvcw0000gn/T/pip-install-jhfn7vc3/enum/setup.py", line 24, in <module>
        version = main_module.__version__
    AttributeError: module 'enum' has no attribute '__version__'

请注意,我已尝试在 Ubuntu 上执行相同的操作。我不得不重复每一步。但是,安装 enum 失败并出现以下错误:

AttributeError: module 'enum' has no attribute 'IntFlag'  

我做错了什么?

您在 pip install page 处出错了。

您应该提供自己的模块 page.py,如 here 所述。

pip install page 拉了一些 garbage and unrelated/unmaintained projects from PyPI.