Cython static link with python runtime?

I have a Python script for python 2.7, say this:

print("Hello World!") 

Then I turn this into C using:

 python cython.py --embed helloworld.py 

And then I try to compile it statically:

 gcc -IC:\Python27\include -LC:\Python27\libs helloworld.c -Wl,-Bstatic -lpython27 -Wl,-Bdynamic 

But gcc just creates a binary file that uses the python27.dll runtime. How to create a binary file statically linked to the runtime?

+7
source share
1 answer

If you are running Linux or OS X, you can use the tool to create my engine, Schafer, which has a β€œbare” mode that will simply build Python statically (for all supported platforms, including Windows), along with several standard modules, and will also be "cythonize" and embed its sources in it. If this does not match your score, you can still get ideas from the source about what is required to accomplish what you want to accomplish.

+2
source

All Articles