12

How do I let my friends use my Python programs? They don't have python installed, but they can use command line programs. I don't have the skill to write GUI.

Let, say I am writing some calculus calculator, with a lot of custom modules and files. How do I share it?

ojrac
  • 13,231
  • 6
  • 37
  • 39
CppLearner
  • 16,273
  • 32
  • 108
  • 163
  • 3
    http://stackoverflow.com/questions/4190635/distributing-programs-written-in-python/5371820#5371820 – pmav99 Dec 16 '11 at 22:33
  • 1
    great link pmav99. I asked this in 2009, however. Thanks for the additional reference. – CppLearner Dec 17 '11 at 20:13
  • Does this answer your question? [How can I distribute python programs?](https://stackoverflow.com/questions/1558385/how-can-i-distribute-python-programs) – halt9k Mar 02 '23 at 10:32

6 Answers6

13

You could use something like py2exe to convert your Python program into an executable.

Sasha Chedygov
  • 127,549
  • 26
  • 102
  • 115
  • will that convert all my modules too? – CppLearner Dec 23 '09 at 01:30
  • For the most part, yes. However, there are some that either won't work or need tinkering. See this page for more details: http://www.py2exe.org/index.cgi/WorkingWithVariousPackagesAndModules – Sasha Chedygov Dec 23 '09 at 01:34
  • Python 'freeze' also does this, and is newer. check out http://wiki.python.org/moin/Freeze – Lee-Man Dec 23 '09 at 01:50
  • Any modules that you have imported in your code will be compiled into the DLLs that accompany the EXE that has been compiled from you code. – inspectorG4dget Dec 23 '09 at 02:24
  • 2
    Since this question is quite old, but still relevant, apparently PyInstaller is a good solution as of 2019 : https://www.pyinstaller.org/index.html – GuitarExtended Feb 20 '19 at 13:45
7

another alternative you can try is Portable python.

Sasha Chedygov
  • 127,549
  • 26
  • 102
  • 115
ghostdog74
  • 327,991
  • 56
  • 259
  • 343
  • It would be better to link to the homepage (http://portablepython.com/) because the download link will quickly become out-of-date. – BCran Jun 14 '14 at 03:51
2

You have the options presented thus far: Portable Python and Py2Exe. Either can be pretty good.

My suggestion: encourage your friends to install Python! As you know, it's free, and simple to install and download. If they want your application bad enough, installing Python will be a no-brainer.

Escualo
  • 40,844
  • 23
  • 87
  • 135
2

In 2019 I have been using PyInstaller mostly, works very well for all of my Python scripts I wish to convert to a single runnable exe.

Community
  • 1
  • 1
pkiller162
  • 352
  • 1
  • 11
1

A less general, but lightweight and simple way of putting many Python files into 1 or 2 files (Python programs) is Fredrik Lundh's squeeze program. When you "squeeze" a bunch of Python programs and modules, you can often produce a single Python program. People still need Python to run it (but it's included in most Unix distributions, including Mac OS X), but you can easily distribute it, as your program and modules are all bunched up in a single file.

Eric O. Lebigot
  • 91,433
  • 48
  • 218
  • 260
1

http://hackerboss.com/how-to-distribute-commercial-python-applications/ mentions using preinstalled, bundled, and frozen interpreters, but i suggest for speed and security, to compile using Shed Skin, Iron Python, Cython, or PyPy. The psyco module also helps with speed if your code is old.

Cees Timmerman
  • 17,623
  • 11
  • 91
  • 124