How to install fastapi in python

  1. Install Python in your local machine.

How to install Python in Window – BlogsHub

2. Create virtual environment

How to Setup Python virtual Environment on Windows – BlogsHub

3 Install fastapi using command prompt

ex: pip install fastapi[all]

or you can follow the below path for reference :

4. Use “pip freeze” command to check all dependencies (which is in lib folder)

5. Create and Import fastAPI inside and create instance

from fastapi import FastAPI

app = FastAPI()

async def root():
    return {"Message" : "fastAPI first programme"}

6. Now start your webserver

syntex: uvicorn filename:instancename
ex: uvicorn main:app  or uvicorn main:app --reload

Leave a Reply

Your email address will not be published. Required fields are marked *