问题
I recently installed Flask-WTF and wtforms and wtf, using pip. I just don't know how to import anyone of these in my python file __init__.py
. I tried:
from wtforms import Form
from Flask_WTF import Form
from wtf import Form
from flask_wtf import Form
from flask_wtforms import Form
etc...
Most of the Flask Documentations tell me to use from wtforms import Form
... But it shows ImportError: No module named wtforms
. It seems like the way you have to import WTF (or however it is called) is not the same anymore. Does anyone know how to import WTF? Thank you!
Update:
I searched for Flask-WTF in the python site-packages
directory, usr/lib/python2.7/site-packages
and found out that there is nothing refering to Flask-WTF. It appears that Flask-WTF was not even installed after running pip install Flask-WTF
or pip install wtf
or pip install wtforms
, even tho the terminal returned that it was. Does anyone know why?
回答1:
I noticed that pip
doesn't install Flask-WTF, so I did it with easy_install
, it worked, and I could import what I wanted to import.
来源:https://stackoverflow.com/questions/45660399/how-can-i-import-flask-wtf