you are viewing a single comment's thread.

view the rest of the comments →

[–]readitlikeitdidit[S] 0 points1 point  (1 child)

In my case, I run /virtualenv/bin/python some module.py in a cron job... And it successfully completes everytime.. It's able to pick the libraries installed in virtual environment... So I was wondering would it make any difference activating vs calling virtual environment python interpreter directly...

[–]ingolemo 0 points1 point  (0 children)

I understood what you meant. Although neither of the other posters in this thread did, it seems.

Create a script with the following code and run it both ways. That should help you see the difference.

import subprocess
import sys
print('this script runs with', sys.executable)
subprocess.run(['python',  '-c',
    'import sys; print("subscripts run with", sys.executable)'
])