Install Flask on Ubuntu and Python Virtual Env

In this post, we will install the Flask web framework on Ubuntu Linux 20.04 inside a Python virtual environment.

If you don’t have a Python virtual environment, let’s create one. First, we need to install Python virtual environment tools using the following command.

sudo apt-get install python3-venv

Now that we have the virtual environment installed let’s create our first virtual environment (dev1) using the following command.

 python3 -m venv dev1

After running the above command, we will have a directory called dev1

Activate Environment

We can now activate the environment using the following code.

source dev1/bin/activate

Install Flask

After activating the environment, we can install Flask inside using pip and the following command.

pip install flask

At this stage, we are done, and we can check that Flask is installed using the –version command.

flask --version

The output is below.

Python 3.8.10
Flask 2.0.1
Werkzeug 2.0.1
Categorized as Flask

Leave a comment

Your email address will not be published.