Creating a virtual environment on Mac and Windows

HermantoXYZ
Jun 10, 2024

--

Creating a virtual environment for a Django app is a recommended practice to manage dependencies and ensure that the project runs in a clean and isolated environment. Below are the steps to create and activate a virtual environment on both macOS and Windows.

  1. On Macs
python3 -m venv venv

Activate the virtual environment

source venv/bin/activate

Once activated, your terminal prompt will change to indicate that you are now working inside the virtual environment.

2. On Windows

python -m venv venv

Activate the virtual environment

venv\Scripts\activate

or

.\venv\Scripts\Activate

Following these steps will help you set up a virtual environment for your Django project on both macOS and Windows.

--

--

No responses yet