KevsRobots Learning Platform
22% Percent Complete
By Kevin McAleer, 2 Minutes

Before diving into coding, itβs essential to prepare a development environment thatβs robust, isolated, and capable of handling our projectβs needs. This setup ensures that you can develop and test your application with consistency and reliability.
FastAPI requires Python 3.7+. If you havenβt installed Python yet or are using an older version, download and install the latest Python version from the official Python website.
A virtual environment is a self-contained directory that contains a Python installation for a particular version of Python, plus a number of additional packages. Using a virtual environment allows you to manage dependencies for different projects, avoiding conflicts between package versions.
To create a virtual environment, run the following commands in your terminal:
python -m venv fastapi-env
To activate the virtual environment, use:
fastapi-env\Scripts\activate.bat
source fastapi-env/bin/activate
With your virtual environment activated, install FastAPI and Uvicorn (an ASGI server for running your application) using pip:
pip install fastapi uvicorn
Create a new directory for your project and navigate into it:
mkdir fastapi_auth_project
cd fastapi_auth_project
Within this directory, create a new file named main.py. This file will serve as the entry point for our FastAPI application.
Youβve now set up your development environment, including Python, a virtual environment, and necessary packages like FastAPI and Uvicorn. In the next lesson, weβll dive into the basics of FastAPI and start building our user authentication system.
Try installing another Python package within your virtual environment and see how it is isolated from the global Python installation. Reflect on how using virtual environments can benefit the development process, especially when working on multiple projects.
You can use the arrows β β on your keyboard to navigate between lessons.
Comments