pex
pex
Updated at 2022-07-18 17:25
pex allows packaging Python code and its dependencies in to a single file. You get myproject.pex which you can simply run if you have a compatible Python interpreter installed. The .pex files cannot include an interpreter.
pex \
. \
-v \
--python-shebang='/usr/bin/env python3' \
--console-script myproject \
--output-file myproject.pex
You can override runtime interpreter with PEX_PYTHON.
PEX_PYTHON=python2 ./myproject.pex
Your code can detect if ran in a .pex file.
Environment Variables:
'PEX' = '/home/user/Downloads/myproject.pex'