Setting up a virtual environment ensures that the project dependencies are isolated and do not interfere with other projects. Follow these steps to set up and activate a virtual environment.
-
Create a new virtual environment in the project directory:
python -m venv venv
-
Activate the virtual environment:
-
On Windows:
.\venv\Scripts\activate
-
On macOS and Linux:
source venv/bin/activate
-
To ensure that the project dependencies are isolated and do not interfere with other projects, it is recommended to use a virtual environment. Follow these steps to set up and activate a virtual environment:
-
Install the
virtualenv
package if you haven't already:pip install virtualenv
-
Create a new virtual environment in the project directory:
virtualenv venv
-
Activate the virtual environment:
-
On Windows:
.\venv\Scripts\activate
-
On macOS and Linux:
source venv/bin/activate
-