3 ms·
> source ./venv/bin/activate To this day I'm not quite sure why the venv developers decided that sourcing was a good idea; all it does can be effectively repla
by Joker_vD 4y ago
> source ./venv/bin/activate
To this day I'm not quite sure why the venv developers decided that sourcing was a good idea; all it does can be effectively replaced with
#!/bin/sh
export VIRTUAL_ENV="path to venv"
export PATH="$VIRTUAL_ENV/bin:$PATH"
unset PYTHONHOME
exec "$SHELL"
Just run this script to get into an "activated" shell. To deactivate, just press Ctrl+D. If you're really fancy, you can replace the last line with
exec "${@:-$SHELL}"
to run a command directly in the activated environment (and then deactivate it immediately).
- ElectricalUnion 4y agoThis technique is simple, doesn't reinvent the wheel, and even has it's own name: Bernstein chaining. http://www.catb.org/~esr/writings/taoup/html/ch06s06.html http://www.catb.org/~esr/writings/taoup/html/ch06s06.html