ImportError: 没有名为 html5 的模块
我尝试了以下步骤来设置Funnel(https://github.com/hasgeek/funnel):
$ git clone https://github.com/hasgeek/funnel
$ cd funnel/
$ cp instance/settings-sample.py instance/settings.py
$ echo "CACHE_TYPE='simple'" >> instance/development.py
然后我安装了以下内容:
- Flask 0.10.1
- Flask-Assets 0.7
- Flask-Mail 0.6.1
- Flask-SQLAlchemy 1.0
- Flask-WTF 0.8
- pytz 2012d
- unicodecsv 0.9.4
- icalendar 3.4
- wtforms-html5 0.1.3
- alembic 0.6.3
- Flask-Migrate 1.2.0
- flask-alembic 0.1
还有从以下地址获取的最新包:
- https://github.com/hasgeek/coaster.git
- https://github.com/hasgeek/flask-lastuser.git
- https://github.com/hasgeek/baseframe.git
然后我运行了:
$ python manage.py db create
我得到了以下输出:
Traceback (most recent call last):
File "manage.py", line 5, in <module>
from funnel import app, models, init_for
File "/home/safiyat/Desktop/PyDev/funnel/funnel-master/funnel/__init__.py", line 35, in <module>
from . import models, forms, views
File "/home/safiyat/Desktop/PyDev/funnel/funnel-master/funnel/forms/__init__.py", line 3, in <module>
from .comment import *
File "/home/safiyat/Desktop/PyDev/funnel/funnel-master/funnel/forms/comment.py", line 6, in <module>
import wtforms.fields.html5
ImportError: No module named html5
我在某个地方看到,html5的小部件和字段从wtforms 1.0.5开始就是内置的,应该直接从wtforms导入。虽然我安装的wtforms是1.0.2,但我仍然遇到了这个错误。为什么呢?有什么解决办法吗?
1 个回答
2
问题解决了。
我需要把我的wtforms升级到1.0.5,使用的命令是 pip install upgrade wtforms
。然后我把Flask-Script从0.6.2降级到0.5.3,命令是 pip install Flask-Script==0.5.3
。这样就可以了。