Python

How to make virtualenvs portable

Like the below, adjust accordingly:

python3 -m venv --copies venv

sed -i '43s/.*/VIRTUAL_ENV="$(cd "$(dirname "$(dirname "${BASH_SOURCE[0]}" )")" \&\& pwd)"/' venv/bin/activate

sed -i '1s/.*/#!\/usr\/bin\/env python/' venv/bin/pip*

source venv/bin/activate

And (I believe, after pip install)

sed -i '1s/.*python$/#!\/usr\/bin\/env python/' venv/bin/*

https://aarongorka.com/blog/portable-virtualenv/



Backlinks: knowledgebase:PROGAMMING