On Windows with virtualenv:

  1. Open the Command Prompt in Windows.
  2. Navigate to the desired directory for your project using cd.
  3. Install virtualenv if you haven’t already with pip install virtualenv.
  4. Create a new virtual environment with virtualenv environment_name.
  5. Activate the virtual environment with environment_name\Scripts\activate.
  6. Install and manage your project’s dependencies within the virtual environment.
  7. Deactivate the virtual environment with deactivate when you’re done.

On macOS with venv:

  1. Open the Terminal on macOS.
  2. Navigate to the desired directory for your project using cd.
  3. Create a new virtual environment with python3 -m venv environment_name.
  4. Activate the virtual environment with source environment_name/bin/activate.
  5. Install and manage your project’s dependencies within the virtual environment.
  6. Deactivate the virtual environment with deactivate when you’re done.

Server and cloud case:

pip install virtualenv
virtualenv ~/<name venv>
source ~/<name venv>/bin/activate

These methods allow you to create isolated virtual environments for your Python projects, making it easy to manage dependencies and specific package versions for each project. Choose the method that best suits your operating system and needs.