4

I've made a program lately that uses Tkinter in Python 3.3. I would like to distribute the program as a simple executable file that does not require an installation. I've had a lot of experience using cx_freeze to compile scripts to executables, but unfortunately it does not produce stand-alone applications, and it requires various DLL and pyd files to be in the current working directory of the executable file it produces. I've also looked into other packaging programs such as py2exe and pyinstaller, but unfortunately they do not support Python 3.x. So, does anybody know how I can compile a Python 3.3 script into a stand-alone executable file without any dependencies?

Thanks!

Update: I have written a python script to move all of the DLL and pyd files inside of the exe file cx_freeze produces. Although this is not a very "clean" solution, it does work with regular python scripts. The problem lies when I import modules such as socket, or tkinter, and the executable file does not know where to look for them, so I get the error:

ImportError: No module named '_socket'

If anybody knows how I can fix this - maybe by changing the location the executable looks for its dependencies - that would be great, thanks again!

Parker Hoyes
  • 2,118
  • 1
  • 23
  • 38
  • Possible duplicate of [How do I compile my Python 3 app to an .exe?](http://stackoverflow.com/questions/17907258/how-do-i-compile-my-python-3-app-to-an-exe) – Cees Timmerman May 18 '17 at 14:27

1 Answers1

1

Consider changing your problem definition to "How can I bake DLLs into a Windows executable?" If you can reframe the problem this way, we can then apply solutions like the ones listed here: how to bundle dependencies in exe

Community
  • 1
  • 1
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
  • I have tried this method also, but like I mentioned, I would like a truly standalone executable that does not require the program to be unzipped to a temporary location. Thanks anyway. – Parker Hoyes Apr 27 '13 at 04:48
  • Who cares if stuff unzips to a temporary location? Is that really important to avoid? If so, why? I honestly thought this sort of solution would be appropriate, but it seems you have other requirements. Will your users really notice or care about these implementation details? – John Zwinck Apr 27 '13 at 05:40
  • It isn't about users noticing this process, but for several other reasons. The main one is that the application is fairly large and takes a while to unzip/rezip. And if I made it go through this process every time it started up, it could severely affect it's start-up time. If I made the program unzip to a temporary location permanently, then this is essentially the equivalent of requiring an installation process, which it is my goal to avoid. – Parker Hoyes Apr 27 '13 at 15:28