Hacker News new | ask | show | jobs
by ProblemFactory 4871 days ago
> for 99.99% of us, virtualenv works perfectly fine for everyday use.

Depends on what you are running and from where. The usual virtualenv activate (although I recommend virtualenvwrapper's workon) works fine for a human interacting with a terminal.

But it is annoying for bash scripts, extremely annoying for Fabric scripts where each command is run in a separate SSH session, and sometimes completely impossible when a server needs to spawn a python subprocess. Used this exact method to solve issues with nginx+uwsgi web server deployments a few weeks ago.

Using the full path to the virtualenv's python works in any context, even when you can't set environment variables or run two commands.

2 comments

Using Fabric's

  with prefix('source venv/bin/activate'):
.. is not annoying in the slightest (to me).
Yeah, just put the venv's bin dir at the head of the script's PATH.