python - ImportError:from flask_wtf import FlaskForm
阿神
阿神 2017-04-18 09:35:15
0
1
1101

大家好,关于flask_wtf,官网上的实例

from flask_wtf import FlaskForm
from wtforms import StringField
from wtforms.validators import DataRequired

class MyForm(FlaskForm):
    name = StringField('name', validators=[DataRequired()])

第一行这样的引入方式,我怎么尝试不成功?在pytone IDE中提示:

ImportError: cannot import name FlaskForm


如果按常规的引入方式:

from flask_wtf import Form

pythone IDE是没问题,但在pycharm中,会有异常提示:

This inspection detects names that should resolve but don't. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items


以上,求解?

  1. 官网的例子是错的吗?

  2. pycharm中为什么公有波浪提示?

阿神
阿神

闭关修行中......

全部回覆(1)
伊谢尔伦
  1. 官網的例子沒有錯,只不過那是0.13版本,你查看的是latest的文檔,而0.12版本的地址是https://flask-wtf.readthedocs...,但是問題是pypi上最高只有0.12 ,也就是說雖然現在有0.13版本,但是作者沒有發不出來,只是文檔更新了,如果要安裝最新的就得使用源碼安裝了

  2. PyCharm的波浪線表示該模組在目前檔案並沒有被使用

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!