1

I've created an executable file using cx_freeze that contains a simple Python script. The .exe file works on my PC (I have Python installed) but is it possible to send it to a colleague, for example, that doesn't have Python on their machine and will it work? The goal is to package useful Python programs and make them available for others to use even if they don't have Python.

I've played around with it a little bit and it doesn't seem to work on non-Python enabled machines. I've sent just the .exe file (didn't work), just the 'build' folder (in a zip file-didn't work) and I've even zipped the whole folder that contains the .py files and the build folder-that also didn't work. However, I thought this was the point of creating the .exe file? Any guidance would be appreciated.

Thanks

bobby_pine
  • 41
  • 6
  • 2
    look at the following thread https://stackoverflow.com/questions/5458048/how-to-make-a-python-script-standalone-executable-to-run-without-any-dependency "PyInstaller" might be able to do the trick – Abraham Oct 04 '19 at 16:33
  • 1
    How exactly the exe file fails to work? Are you sure you included all the modules required for your program into the config of cx_freeze? Do you have the same Windows architecture between your machines (both 64-bit or both 32-bit)? Because the resulting file should just work on a machine without Python. – 9000 Oct 04 '19 at 16:34
  • @9000 In all the instances I have tried the black .exe window opens and just closes almost instantly without executing the underlying script. I have created a really simple script (just counts from one to 1,000) I'm going to try that. Would I have to include the necessary modules in the zip file? – bobby_pine Oct 04 '19 at 16:36
  • Please try opening a command window (cmd.exe), run your exe from there, and observe the output. No, unless you import something tricky for cx_freeze to figure out automatically, you don't need to explicitly include anything. – 9000 Oct 04 '19 at 16:41
  • @9000 just tried with a simple script that requires no modules, it worked! – bobby_pine Oct 04 '19 at 17:06

0 Answers0