5 ms·
Why not just plain virtualenv?
by scaryclam 9y ago
Why not just plain virtualenv?
- mason55 9y agoThere's a link in the article which explains why https://gist.github.com/datagrok/2199506 https://gist.github.com/datagrok/2199506
- ianai 9y agoSo basically I could start up another shell with that as a launching command and it'd be straight back to being "appropriately unixy"
- Ruud-v-A 9y agoYes. I do it with six lines of shell script: https://is.gd/bsNBve https://is.gd/bsNBve.
- bdarnell 9y agoYou can use virtualenv without `bin/activate`. Just refer to `bin/python` (and other scripts in `bin/`) explicitly. Don't bring in the magic until you need it. And when you need it, consider what kind of magic you need. If you're typing `bin/` too much, do you need something that adds `bin/` to your path, or do you need to write a script for this task that saves you from having to type both `bin/` and a bunch of other command-line flags? (I do add my virtualenv's `bin/` directory to my path, but mainly so my editor can find the right tools, so I do it from elisp instead of bin/activate in a shell)
- mason55 9y agoHow do you manage dependencies? One of the best parts about virtualenv (to me at least) is that I can do pip install without infecting the rest of the system. I guess I've never looked, does virtualenv provides a bin/pip which already knows the path of the virtualenv? Does the bin/python in there come with a path that uses the project pip install?
- bdarnell 9y agoYes, exactly. bin/pip inside the virtualenv installs into that virtualenv.
- lgunsch 9y agoThere is a bin/pip you could call directly and have it install packages to the correct path. Even commands installed from packages work that way. I would only use 'bin/python' directly from scripts called from cron, or other similar places.
- crdoconnor 9y ago./venv/bin/pip install package Best part is you can't accidentally install a package in the wrong venv this way. I hate modal systems...
- crdoconnor 9y agoYou can just use virtualenv without activate.
- larrykwg 9y agoIndeed do just use plain virtualenv by all means! Its by far the most mature and most widely adopted solution, I happily ignore all the esoterical "reasons" against it. All those religious arguments are just annoying, it works perfectly fine in cronjobs, systemd unit files, uwsgi services, etc. also lets not forget about pip install --user !