How to Set Up a Virtual Environment in Windows 11

Note: This guide is tailored for Windows 11 users. Steps may vary slightly for other operating systems.

Step-by-step Tutorial

  1. Open the Command Prompt or PowerShell:
  2. Verify Python installation:
  3. Navigate to your project directory:
  4. Create a virtual environment:
  5. Activate the virtual environment:
  6. Verify the virtual environment:
  7. Install packages (optional):
  8. Create a requirements.txt file (recommended):
  9. Deactivate the virtual environment when done:
Tip: To recreate this environment on another machine or after deleting it, navigate to the project directory and run: python -m venv myenv followed by pip install -r requirements.txt

Additional Resources