To generate a out.pex
file from your main.py
script and requirements.txt
file, you can utilize the following command:
pex -r requirements.txt --exe main.py -o out.pex
It's important to note that the resulting pex
file will include your code and its dependencies, but it will not include the Python interpreter. Hence, it is necessary to ensure that the target machine has the appropriate Python interpreter installed.
When you generate the out.pex
file using pex 2.1.137
, the resulting file structure will typically resemble the following:
.bootstrap/
.deps/ <-- Dependencies will be stored in this directory.
__pex__/
__main__.py <-- This is the actual entry-point that uses a shebang (hash sign) and wraps your main.py script.
__pex_executable__.py <-- Your main.py script will be located here.
PEX-INFO