[Python] How to resolve Python Pex binary file location

Discussão em 'Python' iniciado por Stack, Janeiro 29, 2025.

  1. Stack

    Stack Membro Participativo

    Using the pex tool to package python proyects (https://pex.readthedocs.io/en/v2.1.55/); is there a way to know where the original Pex file is located?. Until now I just have been able to see where the "unzipped" files are located but need to programmatically resolve the original file location since the program can run under different environments. I have a test script ~/print_location.py

    import pathlib

    print(pathlib.Path(__file__))


    And the pex binary ~/print_location.pex

    Output:/home/usr/.pex/installed_wheels/4d...e5/print_location-1-py3-none-any.whl/print_location.py

    Expected:/home/usr/print_location.pex

    Continue reading...

Compartilhe esta Página