CREATE ENVIRONMENT

python image

Use the following instructions to install the Python package manager (pip), create and activate the environment and install necessary pip packages.

01

Install pip and environment base

pip is Python's package manager. After installing it, the necessary Python packages can be installed. The first of which will be the virtual environment manager (venv).

Install pip and venv

pagesprouts@linux-server:~$ sudo apt update
pagesprouts@linux-server:~$ sudo apt install python3-pip
pagesprouts@linux-server:~$ sudo apt install python3-venv
Package Purpose
python3-pip python 3 package manager
python3-venv virtual environment manager

02

Create environment and activate

The commands below can be used to create the virtual Python environment and activate it. After doing so, the pip packages can be installed in the newly created environment.

Create environemt and activate

pagesprouts@linux-server:~$ python3 -m venv name_of_enviroment
pagesprouts@linux-server:~$ cd name_of_enviroment
pagesprouts@linux-server:~$ source bin/activate
Package Purpose
python3 -m venv create virtual environment
source bin/activate activate the virtual environment

03

Install pip packages

Use the following command to install necessary pip packages that will be utilized by the Flask application. Only the virtual environment will have these packages installed and will not effect the host Python installation.

Install nessesary pip packages

pagesprouts@linux-server:~$ pip3 install Flask Flask-Mail Flask-SQLAlchemy Flask-WTF waitress dnspython email-validator
Command Function
pip3 install install following Python packages
Flask Python framework
Flask-Mail mail validation
Flask-SQLAlchemy database handling
Flask-WTF form handling
waitress production server
dnspython dns resolve
email-validator validate form data