Python Forum

Full Version: Best method: Python script called from another app, package as complete executable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I am pretty new to Python. I've messed around over the years. I have never packaged or froze a program.

My current project requires me to run a Python script. This python script may have references to other libraries (matplotlib, etc).

But here is where it gets tricky. These are the requirements:
  • Must be able to call script and pass in a couple arguments, like a string
  • The script must be able to be STANDALONE and run on any single Windows computer without need for any installation of other software besides Python.

What is the best way to achieve this and what tools might I look at to do this?

I am complete noob here and don't know where to begin. Thank you
you can cet part of what you need here: http://www.discoversdk.com/blog/how-to-c...hon-module
Does the user need to know Python and how to install a package with pip?
If the answer is yes, then the distribution over pip is ok.

If the user has no knowledge, it's better to deploy on Windows a executable with all dependencies.
There are different ways. Currently the lowest hanging fruit comes from PyInstaller. This
packs the Python Interpreter together with the dependencies and the source code in one executable if needed.
Nuitka is different. This module converts Python to C++ and compiles it. There is still an interpreter, but as far
as I know with optimizations from nuitka. This also able to create exe files for Windows.

Another approach is pynsist, which uses the NSIS installer to install the Python Interpreter together with the pip dependencies + provided local wheels all in a installer. It can also be uninstalled.

I don't like it to provide binary files, but sometimes the requirement enforces this.