How can I distribute python programs?
The normal way of distributing Python applications is with distutils. It's made both for distributing library type python modules, and python applications, although I don't know how it works on Windows. You would on Windows have to install Python separately if you use distutils, in any case.
I'd probably recommend that you distribute it with disutils for Linux, and Py2exe or something similar for Windows. For OS X I don't know. If it's an end user application you would probably want an disk image type of thing, I don't know how to do that. But read this post for more information on the user experience of it. For an application made for programmers you are probably OK with a distutils type install on OS X too.
How to pack and distribute python program (.py source code) so that other developers can easily install all required dependencies?
In the not so old days I used this guide to learn how to package and distribute my python code, then some good people created flit which allows me to do the whole process in three steps.
$pip install flit
Create my metadata file:
[metadata]
author=Some guy
author-email=some-email@nowhere.com
home-page=https://github.com/someuser/somepackage
requires=requests
requires-python= >=3
description-file=README.rst
classifiers=Intended Audience :: Developers
License :: OSI Approved :: BSD License
Programming Language :: Python :: 3
Topic :: Software Development :: Libraries :: Python Modules
Publish my package:
$pip flit publish
And done!!!
Distributing Python programs
You could use something like py2exe to convert your Python program into an executable.
How to distribute a Python script to non-developers on Windows
I have been using PyInstaller for a while now, seems like it would do exactly what you
want.
How to distribute a Python program with external libraries
For convenient, you could try something like pyinstaller.
It will package all of needed module into one folder or or one executable as you like. And it can run in all platforms.
The simple command to make a directory contains an executable file and all needed library is
$pyinstaller --onedir --name=directory_name --distpath="path_to_put_that_directory" "path to your main_program.py"
You can change --onedir
into --onefile
to make that folder into an one executable file which has all the thing it need to run inside.
Related Topics
A Tool to Convert Matlab Code to Python
Python Scope: "Unboundlocalerror: Local Variable 'C' Referenced Before Assignment"
How to Add a Qvideowidget in Qt Designer
How to Set Window Size in Selenium Chrome Python
Cannot Install Python 3.7 on Osx-Arm64
Sum of List of Lists; Returns Sum List
Intercepting Stdout of a Subprocess While It Is Running
How to Change the Python Version in Visual Studio Code
Differencebetween Len() and Sys.Getsizeof() Methods in Python
How to Determine the Length of Lists in a Pandas Dataframe Column
Pandas: Filtering Multiple Conditions
Import a Python Module Without the .Py Extension
Extrapolate Values in Pandas Dataframe