1

(Before marking as duplicate make sure you understand what this question is about)

I have an application that has a Python API, and I want to ship the Python interpreter which would enable users to run Python in interactive mode. The shipped Python will contain my package pre-installed.

The application is written in Java, but I did not want to couple the shipped Python and the application if possible - I wanted to have a self-contained binary that allows running Python in interactive mode and then having my application referencing it. Bottom line is I wanted a way to ship Python itself in a self-contained way, that is a good way to phrase it.

Just to further clarify - the purpose is not to ship a binary with a compiled Python script using something like pyinstaller or freezing tools, as I have found on many duplicate threads such as Shipping interpreter with Python application, Embed Python interpreter in a Python application, How to bundle a Python application including dependencies? and others. The user being able to use Python in interactive mode is a hard requirement.

So, again, the whole point here is being able to run the shipped Python in interactive mode with some pre-installed dependencies, in which case I think the solutions I have found so far (some of them referenced above) are not robust/self-contained enough. Let me know if I am missing something, which might be the case.

luizbarcelos
  • 686
  • 5
  • 17
  • 1
    What language is your application written in? – mkrieger1 Aug 10 '21 at 20:04
  • Java, but I did not want to couple the solution to the application's language if possible, instead I wanted to have this binary that allows to run Python in interactive mode and reference it inside the application (Thanks for the question, I'll update my description on it) – luizbarcelos Aug 10 '21 at 20:11
  • 1
    If any of those options you link to for bundling applications include an interpreter executable somewhere in the distributed folder, then you could use that. I haven't tried, and it's from 2014 with no recent update, but [bbfreeze](https://pypi.org/project/bbfreeze/) does include an executable for the Python interpreter itself. Maybe pyinstaller does that too? Not clear from their docs but I would try it. py2exe does not as far as I can see. – Stuart Aug 10 '21 at 20:46
  • Thanks, @Stuart, that's a good lead. I will try it and let you know. – luizbarcelos Aug 10 '21 at 21:01

0 Answers0