简体   繁体   中英

cannot import name 'Bootstrap5' from 'flask_bootstrap'?

I am running this code

from flask import Flask, flash, jsonify

from flask_bootstrap import Bootstrap5

and I get this error

cannot import name 'Bootstrap5' from 'flask_bootstrap'

I am running this on Mac, python3

According to Bootstrap documentation, basic usage

from flask import Flask
from flask_bootstrap import Bootstrap

def create_app():
  app = Flask(__name__)
  Bootstrap(app)

  return app

# do something with app...

Import Bootstrap instead if Bootstrap5

follow the instructions on https://bootstrap-flask.readthedocs.io/en/stable/basic/#installation

pip uninstall flask-bootstrap bootstrap-flask
pip install bootstrap-flask

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM