[今天,我想在Ubuntu 16.04上设置CTFd,但遇到一个奇怪的ImportError。阅读ImportError: cannot import name 'IntEnum'并尝试了所有可以获得的解决方案后,我发现错误仍未解决。
root@iZbp16wvcnnjq61mspee7aZ:/var/www/CTFd# pip install enum34 //As you can see, I have tried to install enum34 :(
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Requirement already satisfied: enum34 in /usr/local/lib/python2.7/dist-packages (1.1.8)
root@iZbp16wvcnnjq61mspee7aZ:/var/www/CTFd# python serve.py
Traceback (most recent call last):
File "serve.py", line 11, in <module>
app = create_app()
File "/var/www/CTFd/CTFd/__init__.py", line 223, in create_app
from CTFd.api import api
File "/var/www/CTFd/CTFd/api/__init__.py", line 2, in <module>
from flask_restplus import Api
File "/usr/local/lib/python2.7/dist-packages/flask_restplus/__init__.py", line 4, in <module>
from . import fields, reqparse, apidoc, inputs, cors
File "/usr/local/lib/python2.7/dist-packages/flask_restplus/fields.py", line 20, in <module>
from .errors import RestError
File "/usr/local/lib/python2.7/dist-packages/flask_restplus/errors.py", line 8, in <module>
from ._http import HTTPStatus
File "/usr/local/lib/python2.7/dist-packages/flask_restplus/_http.py", line 6, in <module>
from enum import IntEnum
ImportError: cannot import name IntEnum // THE PROBLEM!
我们今天早上遇到了类似的问题,并将enum34固定为1.1.6-他们昨晚发布了1.1.8,由于某种原因,它似乎是一个相对空白的软件包。但是固定为1.1.6对我们有用。
此问题已在enum34 1.1.9
中修复。
这可能是由于enum34软件包的最新版本出现问题:https://bitbucket.org/stoneleaf/enum34/issues/27/enum34-118-broken如建议的那样,解决此问题的方法可以是将其版本固定到1.1.6,这可以正常工作。