How to install fastapi in python
- 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 :
https://fastapi.tiangolo.com/tutorial/#advanced-user-guide
![](https://blogshub.co.in/wp-content/uploads/2023/12/image-10.png)
4. Use “pip freeze” command to check all dependencies (which is in lib folder)
![](https://blogshub.co.in/wp-content/uploads/2023/12/image-11.png)
5. Create main.py and Import fastAPI inside main.py and create instance
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
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
![](https://blogshub.co.in/wp-content/uploads/2023/12/image-12.png)
![](https://blogshub.co.in/wp-content/uploads/2023/12/image-13.png)