Setting up Virtual Environment & Flask
Prerequisites
- Have Python3.* installed
check:
if not installed$ python3 --version
$ sudo apt install python3
- Have pip installed
Check:
if not installed$ pip --version
$ sudo apt install python3-pip
Setup
- Install venv
$ sudo apt install python3-venv
- Create your project folder eg
$ mkdir my-project
- Navigate to the folder
$ cd my-project
Create a virtual environment
$ python3 -m venv virtual
virtual is the name of the virtual environment. Can be any name.
Activate the virtual environment
$ source virtual/bin/activate
- Install flask
$pip install flask
Make sure the virtual environment is activate in the terminal you are running your code on. Always check!!!