Building a statically linked Python, and pip

Skip Montanaro skip.montanaro at gmail.com
Wed May 8 08:59:11 EDT 2019


> > I need to build a statically linked Python that has pip.
>
> What a curious thing to need.

In the old days that was the only way to build Python. I guess we were
just more curious back then. :-)

To the OP, as Thomas pointed out, you're going to have to identify all
the extension modules you need. You will then need to update
Modules/Setup to direct building those modules. The comment at the top
of that file tells you how to get a particular module to be statically
linked.

If you can run your application in an environment which supports
dynamically linked extension modules, you can probably get a good part
of the way there by running the application, then examining it at
runtime (e.g., with lsof on Linux) to see which shared modules have
been loaded.

Curiously yours,

Skip



More information about the Python-list mailing list