Hi,
Iam look looking some standalone python package for both in windows and linux.

In windows py2exe tool serving my purpose,is there any similar tool i can find in linux.?

Though most of linux machine having python installation,but some customized linux machines are not having python.If some body suggest me py2exe like tool for linux,it would be helpful for me execute python script in linux machine which doesnt have python installation.

thanks

Dani AI

Generated

If you need a py2exe-style bundle that runs on Linux machines without Python, the most practical options today are PyInstaller and Nuitka. PyInstaller creates a self-contained binary by bundling a private interpreter; Nuitka compiles your code to C/C++ and can also produce a standalone binary. In both cases, build on the oldest glibc you need to support (or inside a container for that distro) so the result runs on newer systems. Also test on a clean VM to catch missing shared libs.

Quick starts:

# PyInstaller: single-file bundle
pip install pyinstaller
pyinstaller --onefile --name myapp app.py
# add data or fix imports as needed
pyinstaller --onefile app.py --add-data "templates:templates" --hidden-import pkg.submod
ldd dist/myapp    # inspect linked libs
# Nuitka: compiled, standalone binary
pip install nuitka
python -m nuitka --standalone --onefile app.py

A few gotchas: fully static binaries are rare on glibc systems; GUI toolkits and plugins often need extra data files; and antivirus-like false positives can occur with single-file bootloaders. For Alpine/musl, build on Alpine. For speed-sensitive code, Nuitka may yield smaller/faster results than a pure bundler, but expect longer builds.

Echoing ’s point: on Linux, packaging with declared dependencies is friendlier for administrators. Distutils is long deprecated; use setuptools and a pyproject.toml, then build wheels:

# minimal build config
# pyproject.toml
[build-system]
requires = ["setuptools>=68", "wheel"]
build-backend = "setuptools.build_meta"

# build artifacts
python -m build

From there, create a .deb/.rpm that Depends on python3 and your libraries (dh-python, rpmbuild, or a tool like fpm). This keeps updates and security fixes flowing, while still giving users a one-command install.

Recommended Answers

All 4 Replies

Hi nirmalarasu,

I think freeze is what you're looking for.

There's a package called 'distutils' in python. You can find a description in the Python help / Global module index

Thanks four all your replies.
based on your suggestions,I found PyInstaller tool for python stand alone applications.
it easy to make windows exe and linax binary.

Hi nirmalarasu,

I have to say, doing things this way runs counter to the Linux philosophy. You shouldn't be trying to smuggle a mutilated Python interpreter (plus whatever modules you need) onto someone else's machine via freeze or py2exe. That kind of thing might fly on a Windows system, where you're dealing with casual users who don't want to install anything extra, but Linux users by and large want to know what has been installed on their systems so that they can fix any problems which might arise later.

What you ought to do is design an RPM or a Debian-style package with an explicitly declared dependency on Python packages. That way, the users find out up front what your software is doing. Not only that, but package design is a valuable skill to pick up if you want to write open source software for general use. Here is a link to get you started on Debian packages, if you're interested.

Hope this helps!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.