-
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- On macOS/Linux:
source venv/bin/activate - On Windows:
venv\Scripts\activate
- On macOS/Linux:
-
Verify activation:
which python # Should point to venv/bin/python
-
Install packages:
python3 -m pip install package_name
-
Install from requirements.txt:
python3 -m pip install -r requirements.txt