Automation, Orchestration, and Scripting

A developer has a working virtual environment on a test server. A production server must run the same application with identical package versions. Which approach BEST reproduces the dependencies?

Show the answer

Correct answerD. Run pip freeze in the test venv to create requirements.txt, then create a new venv on production and run pip install -r requirements.txt

A frozen requirements file pins exact versions, and installing it into a fresh venv rebuilds the environment on the target. Copying a venv is fragile because it embeds absolute paths to the original interpreter, and omitting versions can install different releases.