4. Install Flask
- Prerequisite: Ensure
Python and pip
(Python Package Manager) are installed on your system. Make sure to use pip's latest version.
- Virtual Env:
Create and activate
virtual env.
- Command: To check if your system has Python installed, run this command in the command prompt:
python --version
- Outcome: If Python is installed, you will get a result with the version number, like this:
Python 3.13.2
If you find that you do not have Python installed on your computer, then you can download it for free from the following website: https://www.python.org/
Command :To check if your system has PIP installed, run this command in the command prompt:
pip --version
Outcome: If PIP is installed, you will get a result with the version number. For me, on a windows machine, the result looks like this:
pip 24.3.1 from C:\Program Files\Python313\Lib\site-packages\pip (python 3.13)
If you do not have PIP installed, you can download and install it from this page: https://pypi.org/project/pip/
Command(Windows): To create virtual environment, run this command in the command prompt:
py -m venv path/to/virtual_env
Command(Unix/MacOS):To create virtual environment, run this command in the command prompt:
python -m venv path/to/virtual_env
Command(Windows): Then you have to activate the environment, by typing this command:
path\to\virtual_env\Scripts\activate.bat
Command(Unix/MacOS): Then you have to activate the environment, by typing this command:
source path/to/virtual_env/bin/activate
Windows:
(path/to/virtual_env) C:\Users\Your Name>
Unix/MacOS:
(path/to/virtual_env) ... $
Command: To install flask and other packages, Navigate to 'Admin/' in the terminal and run this command in the command prompt:
pip install -r /path/to/requirements.txt
Command: After the dependencies are installed, start flask server locally by running:
py main.py
Outcome: This command will start project on development mode. You can visit by http://127.0.0.1:5000/ .