FRANCIS GITHAE
Frank Effect

Frank Effect

Setting up Virtual Environment & Flask

FRANCIS GITHAE's photo
FRANCIS GITHAE
·Jan 24, 2022·

1 min read

Prerequisites

  • Have Python3.* installed check:
    $ python3 --version
    
    if not installed
    $ sudo apt install python3
    
  • Have pip installed Check:
    $ pip --version
    
    if not installed
    $ sudo apt install python3-pip
    

Setup

  1. Install venv
    $ sudo apt install python3-venv
    
  2. Create your project folder eg
    $ mkdir my-project
    
  3. Navigate to the folder
    $ cd my-project
    
  4. Create a virtual environment

    $ python3 -m venv virtual
    

    virtual is the name of the virtual environment. Can be any name.

  5. Activate the virtual environment

$ source virtual/bin/activate
  1. Install flask
$pip install flask

Make sure the virtual environment is activate in the terminal you are running your code on. Always check!!!

 
Share this