5 ms·
Vex seems very convenient, but it is also possible to avoid the "magic" with just standard virtualenv. If you provide the full path to the python binary in the
by ProblemFactory 12y ago
Vex seems very convenient, but it is also possible to avoid the "magic" with just standard virtualenv.
If you provide the full path to the python binary in the virtualenv, it executes with the virtualenv loaded:
/home/acjohnson/virtualenvs/foo/bin/python myscript.py
This is useful for crontabs, system service config, etc. which don't load a regular user's bash setup files.
- shuzchen 12y agoSimilarly, anything you've installed in that virtualenv that installs itself in a bin folder (pip, mercurial, django-admin.py, etc) will be in that bin folder, and calling them from that directory will execute them in the context of that virtualenv as well.
- sashahart 12y agoFully agreed, and the README for vex suggests this if you are worried about overhead from the wrapper especially for non-interactive purposes where you are repeatedly incurring python startup.