7

So I have a python script that relies on a couple modules. Specifically pexpect and pyinoitify. I know you can compile a python script into a .exe in windows, but is there something relatively equivalent in linux? I don't care about it being a binary, I'd just like to be able to distribute my script without requiring the separate installation of pexpect and pyinotify. Is that possible/worthwhile?

3 Answers 3

7

cx_Freeze is a cross-platform way to "freeze" a Python script into standalone binary form. According to their site:

cx_Freeze is a set of scripts and modules for freezing Python scripts into executables in much the same way that py2exe and py2app do. Unlike these two tools, cx_Freeze is cross platform and should work on any platform that Python itself works on. It requires Python 2.3 or higher since it makes use of the zip import facility which was introduced in that version.

Sign up to request clarification or add additional context in comments.

Comments

0

Generally, if the first line is

#!/usr/bin/env python

And the file has "x" mode set (chmod +x yourfile.py)

Then it's executable. No compiling required.

And yes, folks have to install the things on which you depend. It's (a) simpler and (b) less surprising if they actually do the installation, so they know what's really going on.

1 Comment

The question is about distributing the script along with its dependencies, not just executing it.
0

In linux, try to avoid such things. Most package managers handle dependencies quite fine, just distribute your script and tell what dependencies it needs.

1 Comment

Distribute your module as a package and declare a dependency on the other module packages it needs. Problem solved (albeit not portably).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.