[Python] PyInstaller vs Embedded Python

Discussão em 'Python' iniciado por Stack, Fevereiro 4, 2025.

  1. Stack

    Stack Membro Participativo

    I found pyinstaller really anoying before so last time I needed to "compile" python for running that program in a different machine (that didn't have python) I created a script that did the following:

    • Create a build directory
    • Download the embedded version of python as zip (https://www.python.org/downloads/release/python-3132/)
    • Decompress python into build/py and delete the zip
    • Add import site and ../src to build/py/pythonXX._pth to enable site packages
    • Download and execute get-pip using the just-decompressed python interpreter (https://bootstrap.pypa.io/get-pip.py)
    • Add my source code to build/src
    • Run python -m pip install -r build/src/requirements.txt
    • Optionally add a launcher.bat/sh for automatically starting my program using the embedded python

    Question


    • Let's say I create a self-extracting archive off of that directory, do you see anything wrong with this method?


    • From what I know PyInstaller doesn't do it that way, is there any difference? (my guess is, it decreases the final size by a few kb)


    • If you had a wrapper for this method, do you see any advantages to using PyInstaller over this method?

    If you'd like to see my build script let me know

    Continue reading...

Compartilhe esta Página