ComputerGeek
search
Flask Installation — Windows, macOS, Linux Updated: Mar. 22 2026 | Created: Mar. 22 2026

Flask Installation — Windows, macOS, Linux

To install Flask, create a project folder, set up a virtual environment, activate it, and then install Flask using pip.

This guide shows you how to install Flask on Windows, macOS, and Linux.

Before You Install Flask

Before installing Flask, make sure Python is already installed on your computer.

You can check whether Python is installed by running one of these commands in your terminal or command prompt:

# Windows
py --version

# macOS/Linux
python3 --version

If Python is installed, you should see a version number such as Python 3.12.2.

Create a Project Directory

Create a folder for your Flask project:

# Windows, macOS/Linux
mkdir myproject

This creates a folder named myproject in your current directory.

Move Into the Project Directory

Go to the project folder:

# Windows, macOS/Linux
cd myproject

After running the command, your prompt should look similar to this:

# Windows
C:\Users\user\myproject>

# macOS/Linux
~/myproject $

Create a Virtual Environment

Create a virtual environment named .venv inside your project folder:

# Windows
py -3 -m venv .venv

# macOS/Linux
python3 -m venv .venv

This command creates a virtual environment for your Flask project.

Activate the Virtual Environment

Activate the virtual environment so pip installs packages only for this project.

# Windows
.venv\Scripts\activate

# macOS/Linux
source .venv/bin/activate

After activation, you should see (.venv) at the beginning of your terminal prompt:

# Windows
(.venv) C:\Users\user\myproject>

# macOS/Linux
(.venv) ~/myproject $

Install Flask with pip

Now install Flask:

# Windows, macOS/Linux
pip install Flask

pip will download and install Flask and its required dependencies.

Verify the Flask Installation

After installation, verify that Flask is installed correctly.

Option 1: Use the Flask Command

Run:

# Windows, macOS/Linux
flask --version

This shows the installed Flask version.

Option 2: Use pip Show

You can also check Flask using pip show:

# Windows, macOS/Linux
pip show Flask

This displays package information such as the version, location, and dependencies.

Option 3: Check the Version in Python

Open the Python shell:

# Windows
python

# macOS/Linux
python3

Then run:

from importlib.metadata import version
print(version("flask"))

This prints the installed Flask version.

FAQs

'python' is not recognized as an internal or external command

This usually means Python is not installed or not added to PATH on Windows.

To fix it, install Python and make sure the Add Python to PATH option is enabled during installation.

'flask' is not recognized as an internal or external command

This usually means one of these is true:

Activate your virtual environment first, then run:

pip install Flask

After that, try:

flask --version