Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To create an identical virtual environment (venv) with the same parameters as an existing one, you can follow these steps:

First, activate your existing virtual environment:

source /path/to/existing/venv/bin/activate

Or, on Windows:

\path\to\existing\venv\Scripts\activate

Generate a requirements.txt file containing the list of installed packages and their versions:

pip freeze > requirements.txt

Deactivate the current virtual environment:

deactivate

Create a new virtual environment:

python -m venv /path/to/new/venv

Activate the new virtual environment:

source /path/to/new/venv/bin/activate

Or, on Windows:

\path\to\new\venv\Scripts\activate

Install the packages from the requirements.txt file into the new virtual environment:

pip install -r requirements.txt