1

I've looked at some projects like py2exe and a couple other ones. But I want really small under 1mb would be cool but under 300kb would be ideal. Are there any project to possibly extern python into a C compiler or even convert python to C? Maybe there is just a really small python interpreter that I could add only the required libraries to? ( I tried one, it didn't really seem to be "python")

I've looked at a lot of options but I haven't tried them out properly... What can you recommend? I am willing to put the effort into a more complex process if the payoff(small size) is worth it, but I need to narrow down the list.

Zv_oDD
  • 1,615
  • 17
  • 25

2 Answers2

1

The Shedskin solution in Is it feasible to compile Python to machine code? is what you look for however it is not compile an arbitrary python code. And it is not compile to C but to C++.

Xavier Combelle
  • 9,594
  • 4
  • 24
  • 50
0

I mean the closest you will get with python is py2exe and UPX Create the exe but don't bundle anything to it instead make a library then use upx and do the best compression. It has little overhead and can trim another few mb off your final product. Its not the best way but its one of them.

The other option would be to write a snub launcher in C or C++ to fire up a python interpreter and run your source code. While this would be much smaller it would probably be far more complicated to make, if you are looking to follow this method then this link will help you with that.

Jakob Bowyer
  • 30,103
  • 6
  • 69
  • 88