Unable to import flask_login
Question:
I am following the book explore flask on explore flask site, I am getting this error, I just installed flask-login and import this as following
pip install flask-login
from flask_login import login_required
I expect to save this normally without any errors, but VS CODE terminal show this error
“Unable to import ‘flask_login’
Answers:
- First, make sure that flask_login was installed successfully by running “pip list” in your project directory terminal, If it isn’t there then you should install it again
- Second, if it is there so make sure of any typo mistakes, also you can share that piece of code to check it.
Make sure you have installed the version of Flask-Login which is compatible with your Python Version.
If you’re using Python 3 in your Flask App you need pip3 to install compatible parts.
Try:
sudo apt install python3-pip
Then:
pip3 install flask-login
I am following the book explore flask on explore flask site, I am getting this error, I just installed flask-login and import this as following
pip install flask-login
from flask_login import login_required
I expect to save this normally without any errors, but VS CODE terminal show this error
“Unable to import ‘flask_login’
- First, make sure that flask_login was installed successfully by running “pip list” in your project directory terminal, If it isn’t there then you should install it again
- Second, if it is there so make sure of any typo mistakes, also you can share that piece of code to check it.
Make sure you have installed the version of Flask-Login which is compatible with your Python Version.
If you’re using Python 3 in your Flask App you need pip3 to install compatible parts.
Try:
sudo apt install python3-pip
Then:
pip3 install flask-login