Open In App

Install Flask-Sqlalchemy with Pip

Last Updated : 06 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Flask is a Python-based web app framework that helps you develop lightweight and deployable web apps. The Flask framework supports several features like URLs, Templating Engines, and Routing. To provide support for database connection and query, one can use the Flask-Sqlalchemy library in Python, which is one of the popular Python libraries. Flask-SQLAlchemy includes support for using SQLAlchemy in your Flask application on top of your Flask Framework.

In this article, we will look at how to install the Flask-Sqlalchemy package using the pip package manager for Python.

What is Flask-Sqlalchemy?

Flask-SQLAlchemy is a Python library for Flask that provides support for SQLAlchemy in your Flask application. It simplifies the connection process with SQLAlchemy through Flask using various tools and techniques helpful for interacting with the database by providing SQL-Engine and ORM Model and creating, using, deleting, and managing SQLAlchemy objects. This makes using SQLAlchemy easier with Flask.

Feature of Flask-Sqlalchemy

  1. Python Implementation: It is easy to install and doesn’t need any other external libraries or dependencies.
  2. Compatibility: It is compatible with the Python 3.x version and works with Flask. You can download this library from PyPI.
  3. Support for SQLAlchemy database: It acts as an Object-Relational Mapping (ORM) library for SQLAlchemy in Python.

How To Install Flask-Sqlalchemy Via Pip?

You can use pip, which is a Python package manager, to install the Flask-Sqlalchemy library. Follow the below steps to install the Flask-Sqlalchemy library in Python using Pip.

Installing Flask-Sqlalchemy on Windows

Below is the step-by-step procedure by which we can install Flask-Sqlalchemy on Windows in Python:

Step 1: Open Command Prompt

Open Command Prompt on your Windows operating system.

Step 2: Install Flask-SQLAlchemy

Type the below command in the cmd you have opened:

pip install Flask-SQLAlchemy
pip-install

Install Flask-SQLAlchemy using pip

If the above command throws an error, then type the below command:

python -m pip install Flask-SQLAlchemy
python--m-pip-install

Install Flask-SQLAlchemy using Python pip

It will take a few seconds to install. Wait for some time for the installation to finish. Now, you have successfully installed Flask-SQLAlchemy on your Windows system.

Step 3: Verify Installation

You can verify whether the installation was successful by opening your terminal and using the pip show command. If your installation was successful, it will show the package name and details, as shown in the image below.

pip-show-(2)

Verify Flask-SQLAlchemy installation

Installing Flask-Sqlalchemy on MacOS

Below are the step by step procedure by which we can install Flask-Sqlalchemy on MacOS in Python:

Step 1: Open Terminal

Open the Linux Terminal on your Linux machine.

Step 2: Install Flask-SQLAlchemy

Type the below command in the terminal you have opened:

pip3 install Flask-SQLAlchemy
macos-pip-install

Install Flask-SQLAlchemy using pip

If the above command doesn’t work, then run the below command:

python -m pip install Flask-SQLAlchemy

macos-python-pip-install-(1)

Install Flask-SQLAlchemy using Python pip

It will take a few seconds to install. Wait for some time for the installation to finish. Now, you have successfully installed Flask-SQLAlchemy on your Linux system.

Step 3: Verify Installation

You can verify whether the installation was successful, by opening your terminal and using the pip3 show command. If your installation was successful, it will show the package name and details as shown in the image below.

pip3 show Flask-SQLAlchemy

pip-show

Verify Flask-SQLAlchemy installation



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads