2

I want to be able to create a Python standalone executable without any dependencies. Basically, an executable that is closed-source so that anyone end-user/client can use my application. I am aware of the module py2exe; however, it appears that you need some of the .pyc files with it to actually run the .exe file. I am using Python 2.7.x

Any help would be greatly appreciated.

paxtonjf
  • 63
  • 1
  • 9
  • Yes, you can use py2exe. See [tutorial](http://www.py2exe.org/index.cgi/Tutorial) – GAVD Aug 16 '17 at 14:32
  • Possible duplicate of [How to make a Python script standalone executable to run without ANY dependency?](https://stackoverflow.com/questions/5458048/how-to-make-a-python-script-standalone-executable-to-run-without-any-dependency) – zelite Aug 16 '17 at 14:34
  • Alternative you can have a look at PyInstaller: http://www.pyinstaller.org/ – zelite Aug 16 '17 at 14:34
  • not voting to close because Python's pipeline to exe has changed in the last 5-6 years since question mentioned by @zelite – David Aug 16 '17 at 14:36
  • Using PyInstaller - it looks like you need a 64-bit version of Python (I say that because it is giving me a python27.dll (error code 126) and I was doing some research and that seemed to be the issue) and it does cause dependencies. It creates a dist and build directory. I am asking for a standalone executable. – paxtonjf Aug 16 '17 at 15:24
  • Regarding the 64bit. I have no idea. But regarding the standalone exe, there's a command line option to output a single exe: https://pyinstaller.readthedocs.io/en/stable/usage.html#options search for -F, --onefile – zelite Aug 18 '17 at 10:25
  • @zelite That seemed to do the trick. After running pyinstaller yourprogram.py -F you can have the .exe file completely dependent from all of the other folders and files that get generated – paxtonjf Aug 28 '17 at 19:13

1 Answers1

0

Check PyInstaller. This is an alternative to py2exe

http://www.pyinstaller.org/

pip install pyinstaller

pyinstaller yourprogram.py

Community
  • 1
  • 1
name goes here
  • 280
  • 4
  • 10