Automation, Orchestration, and Scripting

A cron job must run /opt/report/run.py using packages installed only in /opt/report/.venv. No shell activation step is available in the crontab. Which command line reliably uses the virtual environment's packages?

Show the answer

Correct answerD. /opt/report/.venv/bin/python /opt/report/run.py

The python executable inside the venv's bin directory uses that environment's site-packages without any activation. The system interpreter ignores the venv, and changing the working directory does not change which interpreter or packages are used.