|
|
|
|
|
by crdoconnor
2886 days ago
|
|
I hate the whole idea of activating virtualenvs. It's a tool that makes it really easy to end up running a command in the wrong environment and see weird behavior instead of a clear error message. I've seen variations on this scenario happen at least 3 times, for instance: 1) Somebody creates script that activates and runs django and commits it. 2) Junior runs script but the virtualenv doesn't get created for some reason. 3) The "warning virtualenv doesn't exist" message appears briefly and gets missed. 4) The junior gets "import error: cannot import django" or something. 5) They then start installing django in their system environment and... it sort of works. Except then they get another import error. And a whole bunch of python packages installed in their system environment. Yech. Moreover, I'm really not sure what was so wrong with just running ./venv/bin/python in the first place and never having to worry about what environment you're in. |
|
You can call the python bin inside the virtualenv and it will run as if the virtualenv was active:
Obviously it doesn't work if devs used different names for their virtualenvs. Work has a convention to always use the same name so this works pretty well.